Forum Discussion

FlorianFey's avatar
FlorianFey
Copper Contributor
Jan 15, 2021

Copy/Paste word using VBA

Hi guys,

 

I try to copy/cut a word in a table cell but it does not work and the cell is empty after the code runned.

 

Public Sub Tabelle_Einfuegen()
    
    Dim word As String
    Dim i As Integer
    
    i = 1
    
    Set BeginnDokument = ActiveDocument.Range(0, 0)
    
    ActiveDocument.Tables.Add Range:=BeginnDokument, NumRows:=1, NumColumns:=1
    ActiveDocument.Words(1).Copy
    ActiveDocument.Tables(1).Cell(1, 1).Range.Paste
    i = i + 1

End Sub

 

But this code actually do what I want, isn't it?

 

Thx!

No RepliesBe the first to reply

Resources