PDA

View Full Version : Custom button to modify body of email being composed



OTWarrior
08-20-2008, 05:55 AM
I often get small requests throughout the day to add items to our database, so when I am done, I send a reply back to the person saying "done" or something similar.

I probably do this about 10 times a day, so was thinking I could just create a macro to put this into the body of the email. Something like:

Sub DoneText()

item.Body = "Done :)" & vbclrf & vbCrLf & item.Body

End Sub

This doesn't work, as it is saying "Object required". I have tried adding teh following to the code:

Dim OutlookApp As Object
Dim MItem As Object
Set OutlookApp = CreateObject("Outlook.Application")

Set MItem = OutlookApp.CreateItem(0)

But I am not creating a new email object, I am wanting to find the current object and "fiddle" with it.


Any help would be appreciated :help

Mavyak
08-20-2008, 06:26 AM
I think this will get it:

Set MItem = ActiveInspector.CurrentItem

OTWarrior
08-20-2008, 07:18 AM
That worked perfectly, thank you :)


Now I have another problem. I compose email in HTML format (so I can use my signature and so there is proper formating), whereas this code turns it all into rich text (or so I think). Is it possible to keep the original formating?

OTWarrior
08-20-2008, 07:23 AM
Nevermind, Just found that it can be done by using:
item.HTMLBody
instead of
item.Body