Views

Histats

Vitrine

VBA Excel - Exemplos de Copiar e Colar - 05

Este código colará o intervalo do MS Excel num documento do MS Word, deixando-o interligado ao MS Excel.



Sub LinkWorkBookToMsWord()
    Dim xlTable As Object
    Dim r As Range
   

    Set r = Worksheets("Sheet1").Range("A1", Range("B65536").End(xlUp))

    Set xlTable = CreateObject("Word.Application")

    Let xlTable.Visible = True
    r.Copy
    xlTable.documents.Add
    xlTable.Selection.PasteSpecial Link:=True, DataType:=wdPasteOLEObject, Placement:= _
                                   wdInLine, DisplayAsIcon:=False
    xlTable.activedocument.SaveAs ThisWorkbook.Path & "/" & "LinkedToWord.doc"
    xlTable.documents.Close
    xlTable.Quit
    Application.CutCopyMode = False
End Sub

Tags: Excel, VBA, copy, paste, MS Word, Word,


Inline image 1

✔ VBA Brazil®

✔ VBA Brazil®
brazilsalesforceeffectiveness@gmail.com
Related Posts Plugin for WordPress, Blogger...
diHITT - Notícias