Private
Sub
CommandButton1_Click()
Dim
wdApp
As
Object
, wdDoc
As
Object
, wdTbl
As
Object
, _
Zeile
As
Long
, Spalte
As
Long
Set
wdApp = CreateObject(
"Word.Application"
)
wdApp.Visible =
True
Set
wdDoc = wdApp.Documents.Add(
"Y:\Word\Vorlagen\Tabelle.dot"
)
Set
wdTbl = wdDoc.Tables(1)
For
Zeile = 1
To
2
For
Spalte = 1
To
3
wdTbl.Cell(Zeile, Spalte).Range.InsertAfter Cells(Zeile, Spalte)
Next
Spalte, Zeile
wdDoc.SaveAs wdDoc.Path &
"\Neue_Tabelle.doc"
wdApp.Quit
Set
wdTbl =
Nothing
Set
wdDoc =
Nothing
Set
wdApp =
Nothing
End
Sub