calling TF ... (creating Emails in Vb)

G

Guest

Hello Tim While brousing a thread I found the following code of yours for creating Emails in Vb:

Dim SubjectLine, Email_Content As String
Dim myOlApp As Outlook.Application
Dim myItem As MailItem

Set myOlApp = CreateObject("Outlook.Application")
SubjectLine = "The Subject of the email"
Email_Content = "Hello. Just a reminder that you owe me a phone call." & Chr(10) & "Call me today."
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Subject = SubjectLine
myItem.Body = Email_Content
myItem.To = "(e-mail address removed)"
myItem.Send
Set myOlApp = Nothing
Set myItem = Nothing

It wprks fine, but I also need to include a file as an attachment to the Email, could you tell me how to modify the code to do that please?
Many thanks
Wes.
 
T

Tim Ferguson

Hello Tim While brousing a thread I found the following code of yours
for creating Emails in Vb:

Don't think it's me. I stay well away from anything that approaches driving
email from a database.

Tim F
 
G

Guest

Hi Wez,

You can add an attachment with the following code ... you only need to supply the full path to the file you want to attach.

MyItem.Attachments.Add "PathToFileHere"
 
G

Guest

Thank you Steve.

Steve M. said:
Hi Wez,

You can add an attachment with the following code ... you only need to supply the full path to the file you want to attach.

MyItem.Attachments.Add "PathToFileHere"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top