chuchazoelrotazo
asked on
send an attachment at vb runtime
How can I send a file via email at runtime in visual basic? (it would be wonderful if the user never sees the outlook window)
thanks for any help
thanks for any help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately.
To cleanup this TA, I will recommend to moderators that this question is:
*** Answered by: Dhaest ***
Please leave any comments here within the next seven days, or finalize the question if you own it
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
peterchen
EE Cleanup Volunteer
To cleanup this TA, I will recommend to moderators that this question is:
*** Answered by: Dhaest ***
Please leave any comments here within the next seven days, or finalize the question if you own it
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
peterchen
EE Cleanup Volunteer
ASKER
thanks to all
Here is an example using Outlook, customize the code as neccessary:
Private Sub Command1_Click()
Dim iOutlook As Outlook.Application
Dim myApp As Outlook.MailItem
Set iOutlook = New Outlook.Application
Set myApp = iOutlook.CreateItem(olMail
temp = "ryancys"
txtMessage = "Hello World Again!"
AttachFile = "C:\Documents and Settings\Administrator\My Documents\My Pictures\next.gif"
myApp.To = "abc@yahoo.com"
myApp.Subject = "Hello World!"
myApp.Attachments.Add AttachFile
myApp.Body = "Hi " & temp & vbCrLf & vbCrLf & txtMessage
'myApp.HTMLBody = ""
myApp.Send
'Do While iOutlook.GetNamespace("MAP
' DoEvents
'Loop
MsgBox "Successfully Sent", vbInformation, "Email Sent"
End Sub
Alternatively See use tools:
http://www.freevbcode.com/ShowCode.Asp?ID=109