objMailItem options

SteveSage

New Member
Joined
Sep 24, 2008
Messages
1
I've been using an inherited excel macro to generate a email using objMailItem and have worked out the basics, but am struggling to put in place some changes that will allow the macro to do things a little better.
Currently I have the following :

With objMailItem
.To = tolist
.Cc = cclist
.Subject = Subject
.body = sMsg
.attachments.Add filenamepath, 1
.Display
End With

So the enhancements i amm trying to do are :
a) the mail has to go in rich text format, but is there any way to set the format of each line in the ".body";
b) if I wanted to add some additional text after the attachment, how do I do this (adding a 2nd .body after the attachment does not seem to work); and
c) how do I add multiple attachments (rather than just the 1)

Appreciate any help
Thanks
Steve
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Steve

a) There is no 'rich text' format. Perhaps you mean HTML format? If so use HTMLBody instead of just Body.

b) Don't quite know what you mean there.:eek:

c) Just repeat attachments.Add

PS This is all assuming you are using Outlook.:)
 
Upvote 0
Outlook can use rich text format but I think in order to do it you have to actually create the rtf string including formatting codes and then pass that to the body property. As far as I know, you have no control over where the attachments end up, but you could try setting the Body, adding an attachment, then set the Body = Body & newtext and so on.
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top