Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / January 2005

Tip: Looking for answers? Try searching our database.

No Attachment send

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ilja Zwolsman - 18 Jan 2005 11:00 GMT
Hi,  
I am trying to automate sending an e-mail message and an
attachment from vba in excel.
Using the following code the message is put into the
outbox. When I then use the sending option under the tools
menu the message is send but the attachment is not.
I am using windows 98se and officeXp.      
set myOlApp = CreateObject("Outlook.Application")
   Set myItem = myOlApp.CreateItem(olMailItem)
   Set myRecipient = myItem.Recipients.Add
("euredinl03@maersk.com")
   With myItem
      .Display
      .Save
      Set myAttachments = .Attachments
      myAttachments.Add "H:\Expeditie\Xml_Verzonden\" &  
SaveName & ".xml", _
      olByValue, 1, "Xml bestand voor Maersk"
      .Subject = "Shipping Instructions ( " & SaveName
& " ) "
      .body = " Dear Sir/Madam, " & vbCrLf & _
                 " " & vbCrLf & _
                 " Attached you will find new shipping  
instructions." & vbCrLf & _
                 " " & vbCrLf & _
                 " Kind regards," & vbCrLf & _
                 " " & vbCrLf & _
                 "TCCModexpress B.V. "
      .Send
end with
Set myOlApp = Nothing
Michael Bauer - 28 Jan 2005 05:53 GMT
Hi Ilja,

do you get an error? If you use an "On Error Resume Next" statement,
then you won´t get one, of course. Please comment out this line for
testing. I suppose the attachment doesn´t exist for the given path.

Signature

Viele Grüße
Michael Bauer

> Hi,
> I am trying to automate sending an e-mail message and an
[quoted text clipped - 27 lines]
> end with
> Set myOlApp = Nothing
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.