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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OUTLOOK - VBA 1

Status
Not open for further replies.

diezzz

Technical User
Oct 11, 2006
28
HU
Hello,

I've built an automatic mail to send from time to time to some usors. The mail is dispayed when i run a macro and then i send it. I'm having few questions however.

The code looks like that

set InfoMail as ...
infomail.subject = ...
infomail.body = ....
infomail.display

However, i would like, if possible, to se the from field as "information.team@isp.com' for example and i can't manage this.

Also in the body of the mail i would also like to have an attachement, automaticaly added when i run the macro.

So,

1)How can i add exactly what i want in the 'from' field and 2)how can i attach using vba a file, in a certain place in the body of the message?
 
How about this:

Code:
infomail.SentOnBehalfOfName = "information.team@isp.com"

'' Function Add(Source, [Type], [Position], [DisplayName]) As Attachment

infomail.Attachments.Add "C:\myattachment.xxx"

TomCologne
 
That worked great, thanks alot. However i have another question.

In a mail the attachement is shown as a little telephon icon. The body of the mail is :

Simply click on the "link" to have acces to the application, or use your desktop icon (the phone icon here). Bla bla bla...

However, when i add the icon, witch is a bitmap, it dosen't show the phone in the body, only the bitmap icon and it's name. Can i somehow show directly the icon, so the user won't have to open the bitmap to see how the icon looks like?

Also, how can i add this attachement in the middle of my body? I can manage only to add it before or after the body.

Here is my code for example :



Sub info()
Set info = ThisOutlookSession.CreateItem(olMailItem)
info.SentOnBehalfOfName = "team@isp.com"
info.Subject = "Information Mail"
info.BCC = "me@isp.com"
info.body = "tatata" & Chr(10) & chr(10) & "tatata" &(picture should be here, left side of the message) & tatatata" &chr(10) & "best regards"

Set myAttachments = info.Attachments
myAttachments.Add "D:\xxx.bmp", _
olByValue, 1, "Info"
info.Display

I hope someone can help me on this issue also
Thanks,
Diezzz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top