Thanks for your reply.
My users have clarified there objectives into two, however I would still appreciates some assistance.
I am using code from 210261 to try to resolve the requirements.
#1 To have the word application open, data entered, save in C:\My Documents with a file name which combines both the Client ID & SalesmanID, and then closes Word. I have shown in the code where I believe I need some revised code.
#2 To have the word application open, data entered, a file name which combines both the Client ID & SalesmanID, emailed through Outlook, and then closes Word. Regarding the email address, this could be found from the the open form.
If anyone can help me with the above, I would be very grateful
Thanks
CODE:
Private Sub MergeButton_Click()
On Error GoTo MergeButton_Err
Dim objWord As Word.Application
'Start Microsoft Word 2000.
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("C:\My Documents\review test.doc")
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("ClientID").Select
.Selection.Text = (CStr(Forms!frmReview!ClientID))
.ActiveDocument.Bookmarks("Street").Select
.Selection.Text = (CStr(Forms!frmReview!PCStreet))
.ActiveDocument.Bookmarks("TownorCity").Select
.Selection.Text = (CStr(Forms!frmReview!PCTownOrCity))
.ActiveDocument.Bookmarks("Salesman").Select
.Selection.Text = (CStr(Forms!frmReview!SalesmanID))
End With
'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
objWord.ActiveDocument.PrintOut Background:=False
'Close the document saving changes into another document.
objWord.ActiveDocument.Close SaveChanges:=wdSaveChanges
Need some help here i think?
'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = Nothing
Exit Sub
MergeButton_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
'If the Photo field is empty.
ElseIf Err.Number = 2046 Then
MsgBox "Please add a photo to this record and try again."
Else
MsgBox Err.Number & vbCr & Err.Description
End If
Exit Sub
End Sub