Re: Capturing in code the Rtf and Html of a merge document



Thank-you yes, I realized that. Could you please respond to my questions?
Thank you.

bob

"Doug Robbins - Word MVP" wrote:

The code that I posted captures the document created for each record in the
data source, not the record.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Marketware" <Marketware@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4033196D-8047-4305-9D81-AD35790E907A@xxxxxxxxxxxxxxxx
Thank you for responding to my question! I really appreciate it.

From your response then, I assume the best approach is to capture each
record via the clipboard?

What I am trying to do is capture the body of the merge document (merged)
like this:

Dear <<Saluation>>:

I hope all is well at <<Company_Name>>...

Convert it to:

Dear Fred:

I hope all is well at ABC Company...

And take the merged data and insert it into the body of the email.

Now the question I have from your response is...I notice you are
attempting
to invoke the .WordEditor and you've set the format to HTML.

Is HTML the only format that this will work with reliably? Or can you do
it
with Rich Text or Plain Text too? Also, can you set the Format on the fly
or
are you limited to the message format the end user has set in his/her
Options?

Thank you sooooooo much!!!

bob


"Doug Robbins - Word MVP" wrote:

The following code contains where indicated by the **** the commands
necessary to create such an email message. If you were to use something
similar and omit the .Send command, the email message will probably be
available for the user to edit it if necessary and then send it manually.

Dim Source As Document, Maillist As Document, TempDoc As Document
Dim DataRange As Range
Dim i As Long, j As Long
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Dim mysubject As String, message As String, Title As String

Set Source = ActiveDocument

' Check if Outlook is running. If it is not, start Outlook
On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

' Open the catalog mailmerge document
With Dialogs(wdDialogFileOpen)
.Show
End With
Set Maillist = ActiveDocument

' Show an input box asking the user for the subject to be inserted into
the
email messages
message = "Enter the subject to be used for each email message." ' Set
prompt.
Title = " Email Subject Input" ' Set title.
' Display message, title
mysubject = InputBox(message, Title)

' Iterate through the Sections of the Source document and the rows of the
catalog mailmerge document,
' extracting the information to be included in each email.
For j = 1 To Source.Sections.Count - 1
Source.Sections(j).Range.Copy
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.Subject = mysubject
'****
.BodyFormat = olFormatHTML
.Display
Set objDoc = .GetInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
objSel.Paste
'****
Set DataRange = Maillist.Tables(1).Cell(j, 1).Range
DataRange.End = DataRange.End - 1
.To = DataRange
For i = 2 To Maillist.Tables(1).Columns.Count
Set DataRange = Maillist.Tables(1).Cell(j, i).Range
DataRange.End = DataRange.End - 1
.Attachments.Add Trim(DataRange.Text), olByValue, 1
Next i
.Send
End With
Set oItem = Nothing
Next j
Maillist.Close wdDoNotSaveChanges


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Marketware" <Marketware@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2FD8DC29-34E2-4E16-B01D-C13EA2BEDF14@xxxxxxxxxxxxxxxx
I would like to create mail merge letters in word and use those for
outlook
as form emails after merging the data into the document. (one at a
time
so
the user can make any changes in the inspector before pressing send)

What is the appropriate properties from the word document that could
give
me
the rtf and the HTML code from the word document after it has been
merged?

for example

outlookobject.HTMLbody = activedocument.??? //html email

outlookobject.RTFbody = activedocument.??? //rtf email

outlookobject.body = activedocument.??? //text email

Thanks in Advance!!

bob







.



Relevant Pages

  • Re: Capturing in code the Rtf and Html of a merge document
    ... What I am trying to do is capture the body of the merge document ... necessary to create such an email message. ... Dim Source As Document, Maillist As Document, TempDoc As Document ... Set oItem = oOutlookApp.CreateItem ...
    (microsoft.public.word.vba.general)
  • Re: Capturing in code the Rtf and Html of a merge document
    ... necessary to create such an email message. ... Dim Source As Document, Maillist As Document, TempDoc As Document ... Set oItem = oOutlookApp.CreateItem ... Set DataRange = Maillist.Tables.Cell.Range ...
    (microsoft.public.word.vba.general)
  • Re: Capturing in code the Rtf and Html of a merge document
    ... If you were to use something similar and omit the .Send command, the email message will probably be available for the user to edit it if necessary and then send it manually. ... Dim Source As Document, Maillist As Document, TempDoc As Document ... Set oItem = oOutlookApp.CreateItem ... Set DataRange = Maillist.Tables.Cell.Range ...
    (microsoft.public.word.vba.general)
  • Re: Mail Merge HTML Format Word 2002 XP SP3
    ... of using mailmerge to create the personalised content of the email message, ... The body text format determines the standard used to display the text of the ... Text, Rich Text, and HTML. ... Dim olApp As Outlook.Application ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Complex e-mail merge with unique attachment
    ... If the text that you want to be included in the body of the email message is ... Dim Source As Document, Maillist As Document ... ' Open the catalog mailmerge document ... Some recipients were leery of opening an unexplained attachment so I needed to include a short message within the e-mails themselves by way of explanation. ...
    (microsoft.public.word.mailmerge.fields)

Loading