Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   Problem with mail attachements (http://www.go4expert.com/forums/mail-attachements-t3920/)

CFC 409 18Apr2007 15:14

Problem with mail attachements
 
Hi,

I found this code in your site and I happy to use it.
Code:


Code:

Dim objOutlookMsg As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
With objOutlookMsg
  .To = "name@email.com"
  .Cc = "name@email.com"
  .Subject = "Hello World (one more time)..."
  .Body = "This is the body of message"
  .HTMLBody = "HTML version of message"
  .Attachments.Add ("f:\Test.txt")
  .Send 'Letīs go!
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

I need attach more than one file in the same mail. For example I need attach all text files that are in directory. I tried to use string:

.Attachments.Add ("f:\Directory\*.txt")

but it did not work. Could you help me.
Thank you.

pradeep 18Apr2007 19:06

Re: Problem with mail attachements
 
You'll have to loop through the file list in a directory and add the files individually!
Use the filesystem object.


All times are GMT +5.5. The time now is 10:41.