calling TF ... (creating Emails in Vb)

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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"
 
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"
 
Back
Top