Hi, I'm a novice programmer trying to make my email maintenance simpler. I'm using XP and Outlook 2003 and trying to create a macro that will save attachments in a chosen location and update the email body to have a hyperlink to that location. After cloning code from this and other sites I have got my macro working fine on the machine I developed it on. However, when I run it on my works Outlook client I get "Run-time error '287': Application-defined or object-defined error"
On investigation the error is caused by the line
myItem.HTMLBody = Replace(myItem.HTMLBody, "</BODY>", strSave & "</BODY>", , , vbTextCompare)
where strSave is my formatted string containing the links
On further trial and error on the office machine I find I can do the following OK
strTemp = "<HTML><BODY> Fred </BODY></HTML>"
myItem.HTMLBody = strTemp
myItem.Save
This does save my item with just the text Fred in it
However, if I try to do
strTemp = "<HTML><BODY> Fred </BODY></HTML>"
myItem.HTMLBody = strTemp
strTemp = myItem.HTMLBody
I get the 287 error on the strTemp = myItem.HTMLBody line
I'm guessing it must be something to do with security settings somewhere but it seems weird to me that I can set HTMLBody but can't get at the original contents of it.
Any suggestions ?