ted.martin
Registered User.
- Local time
- Today, 00:17
- Joined
- Sep 24, 2004
- Messages
- 743
I have been trying to get this to work but without success.
My original source was
http://www.slipstick.com/developer/merge-email-without-using-word/
The code looks good apart from the fact that the Inpector was not Dimensioned. Anyway, here is my code which fails as the error message is that objSel is not set.
Any help would be appreciated as using Bookmarks in an eMail is going to be very useful.
Thanks.
My original source was
http://www.slipstick.com/developer/merge-email-without-using-word/
The code looks good apart from the fact that the Inpector was not Dimensioned. Anyway, here is my code which fails as the error message is that objSel is not set.
Code:
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItemFromTemplate(DLookup("TemplateFolder", "Company Details") & "eMail Template bm4.oft")
MyMail.To = strTarget
MyMail.Subject = "Test"
' MyMail.Display (True)
' after the Message is open and addressed to recipient, use the Reference WORD to put fields into Bookmarks
Dim objInsp As Outlook.Inspector
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objSel As Word.Selection
Set objInsp = MyMail.GetInspector
Set objDoc = objInsp.WordEditor
Set objWord = objDoc.Application
Set objSel = objWord.Selection
objSel.Goto What:=wdGoToBookmark, Name:="bm1"
objSel.TypeText ("Text 1")
objSel.Goto What:=wdGoToBookmark, Name:="bm2"
objSel.TypeText ("Text 2")
objSel.Goto What:=wdGoToBookmark, Name:="bm3"
objSel.TypeText ("Text 3")
objSel.Goto What:=wdGoToBookmark, Name:="bm4"
objSel.TypeText ("Text 4")
Any help would be appreciated as using Bookmarks in an eMail is going to be very useful.
Thanks.