spilwayboy
Registered User.
- Local time
- Today, 22:59
- Joined
- Dec 17, 2002
- Messages
- 17
I have the following code that mail merges access to word fine:
Private Sub Option6_Click()
' Open a Fax Cover Sheet in Word and insert text - used by menu command.
Dim dbs As DAO.Database
Dim rstMergeThese As Recordset
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
With oApp
.Documents.Open "Z:\Word Templates\Phone Conversation Record.doc"
' Move to each bookmark and insert text from the form.
.ActiveDocument.bookmarks("CompanyName").Select
.Selection.Text = (CStr(Forms!company!CompanyName))
.ActiveDocument.bookmarks("CompanyPhoneNumber").Select
.Selection.Text = (CStr(Forms!company!CompanyPhoneNumber))
.ActiveDocument.bookmarks("FirstName").Select
.Selection.Text = (CStr(Forms!company!Contacts!FirstName))
.ActiveDocument.bookmarks("LastName").Select
.Selection.Text = (CStr(Forms!company!Contacts!LastName))
.ActiveDocument.bookmarks("InsertText").Select
'if word isn't running, start and activate it
If Err Then
Shell "C:\Program Files\Microsoft Office\Office\" & "WinWord / Automation", vbMaximizedFocus
AppActivate "Microsoft Word"
End If
Set oApp = Nothing
End With
End Sub
My question is that I would like to use a message box to fill in some additional data at set bookmarks throughout the document? What code would I need to add and where to make a message box pop up when the code is run and the document is opened that would allow the user to enter data in the message box and then transfer that data to the word document? Thanks in advance for any help.
Spil
Private Sub Option6_Click()
' Open a Fax Cover Sheet in Word and insert text - used by menu command.
Dim dbs As DAO.Database
Dim rstMergeThese As Recordset
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
With oApp
.Documents.Open "Z:\Word Templates\Phone Conversation Record.doc"
' Move to each bookmark and insert text from the form.
.ActiveDocument.bookmarks("CompanyName").Select
.Selection.Text = (CStr(Forms!company!CompanyName))
.ActiveDocument.bookmarks("CompanyPhoneNumber").Select
.Selection.Text = (CStr(Forms!company!CompanyPhoneNumber))
.ActiveDocument.bookmarks("FirstName").Select
.Selection.Text = (CStr(Forms!company!Contacts!FirstName))
.ActiveDocument.bookmarks("LastName").Select
.Selection.Text = (CStr(Forms!company!Contacts!LastName))
.ActiveDocument.bookmarks("InsertText").Select
'if word isn't running, start and activate it
If Err Then
Shell "C:\Program Files\Microsoft Office\Office\" & "WinWord / Automation", vbMaximizedFocus
AppActivate "Microsoft Word"
End If
Set oApp = Nothing
End With
End Sub
My question is that I would like to use a message box to fill in some additional data at set bookmarks throughout the document? What code would I need to add and where to make a message box pop up when the code is run and the document is opened that would allow the user to enter data in the message box and then transfer that data to the word document? Thanks in advance for any help.
Spil