Excel -> Serienbrief --> Word
28.04.2009 14:43:10
Captain
komme hier nicht weiter und habe ein Problem! :-(
Habe eine Adressdatenbank in Exel und möchte nun für jede Zeile je ein Dokument ausdrucken. Beim ersten Aufruf funzt das auch einwandfrei und dann nicht mehr. Ich weiß auch warum! Meine .dot Datei bzw. die Textfelder sind nicht geschützt und die Textmarken sind dann wech!?
Wie kann ich das jetzt umgehen?
Danke
If Dir(oFile) "" Then
Set appWord = CreateObject("Word.Application")
appWord.Visible = True
appWord.WindowState = wdWindowStateMinimize
appWord.documents.Open oFile
For i = 2 To Worksheets("Hunde").UsedRange.Rows.Count
If Worksheets("Hunde").Cells(i, 41) = "" Then
appWord.activedocument.bookmarks("Vorname").Range.Text = Worksheets("Hunde"). _
Cells(i, 4)
appWord.activedocument.bookmarks("Name").Range.Text = Worksheets("Hunde").Cells( _
_
i, 3)
appWord.activedocument.bookmarks("Straße").Range.Text = Worksheets("Hunde"). _
Cells(i, 11)
appWord.activedocument.bookmarks("Hausnummer").Range.Text = Worksheets("Hunde"). _
_
Cells(i, 12)
appWord.activedocument.bookmarks("PLZ").Range.Text = Worksheets("Hunde").Cells( _
_
i, 13)
appWord.activedocument.bookmarks("Ort").Range.Text = Worksheets("Hunde").Cells( _
_
i, 14)
appWord.activedocument.PrintOut
End If
Next i
Else
MsgBox "Das Dokument wurde nicht gefunden!", vbCritical, "Hinweis"
End If
Jack