Hallo,
In meinem Formular hab ich derzeit einen Button der eine bestimmte Wordvorlage öffnet und den Briefkopf und andere Spalten mit Werten aus der Datenbank füllt. Funktioniert auch super.
CODE:
Private Sub Wordbutton_Click()
'Start Microsoft Word.
Set objWord = CreateObject(„Word.Application“)
With objWord
'Make the application visible.
objWord.Visible = True
'Open the document.
objWord.Documents.Open („F:\db1\db_solve.dot“)
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks(„Anrede“).Select
.Selection.Text = Me!Anrede
.ActiveDocument.Bookmarks(„Vorname“).Select
.Selection.Text = Me!Vorname
.ActiveDocument.Bookmarks(„Name“).Select
.Selection.Text = Me!Name
.ActiveDocument.Bookmarks(„Name2“).Select
.Selection.Text = Me!Name
.ActiveDocument.Bookmarks(„sn“).Select
.Selection.Text = Me!sn
.ActiveDocument.Bookmarks(„Kundennummer“).Select
.Selection.Text = Nz(Me!Kundennumemr)
End With
Set objWord = Nothing
End Sub
Mein Problem ist das ich ca. 10 unterschiedliche Wordvorlagen habe, auf die ich diese Funktion anwenden möchte (Mit meinem button kann ich ja nur eine öffnen). So eine Art DropdownButton gibt es wohl nicht?! Ich könnte alle 10 als Makro abspeichern und müsste dann nur einen Button hinbekommen, der das jeweilige Makro auswählt (dropdown?) und somit die gewünschte Wordvorlage öffnet.
Kann jemand helfen?
MFG