Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interacting with Outlook 1

Status
Not open for further replies.

Kalisto

Programmer
Feb 18, 2003
997
GB
I have now got a simple method in my vba code that can create an email, adn send it to my drafts folder.

On top of that, I have a bit of code that can walk through all the folders in a users Outlook and seelct the Templates Folder.

Once I have the template I need, then I hit a brick wall.

the code is
Code:
  With templateMail
        Dim s As String
        Set s = templateMail.Body
    End With

where templateMail is of type MailItem

Via the Object Browser I can see the Body property, and in the object browser it is a string. But I cannot retrieve it.

What I need to do is to parse the body in some way, so that I can search for certain tokens (in this case {Reason}, and replace that with the reason that the rejection has ocurred.)

however the code runs to s and then complains that an object is required. I have tried to make s an object, but that makes no difference.

Help!

K
 
Have you tried simply
Code:
s = templateMail.Body
or
Code:
s = .Body

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
if I dont have the Set in there it complains about the object variable needing a set

I'll try the s = .Body later, cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top