Merge data for one record to word or outlook

PaulJK

Registered User.
Local time
Today, 13:15
Joined
Jul 4, 2002
Messages
60
Hi,

I would like to have data contained in one of my forms (ie one customer only the current record - not the whole customer base) send to either a Word or Outlook template.

Currently reading 201271 Knowledge base. Word may be easier, but would then require manual intervention to email on. I am not sure how I could do this or create such a template in outlook.

Could anyone provide any tips on solutions they have got to work?

Thnak you.
 
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
 
Merge data

I have a system built that merges data from the current record to a Word document, adds an image if present, saves the document using field data, then emails it as an attachment to an Outlook message. Would this work for you?
 
Dennis,

The application you mentioned sound just what I am trying to do. I have sent you a private message with my e-mail details. If you can help me by forwarding some details, I would be grateful.

Thank you,

paul
 

Users who are viewing this thread

Back
Top Bottom