Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple attachments best way to go about. 1

Status
Not open for further replies.

macca007

Programmer
May 1, 2004
86
GB
Hi i hav code which found from this website to send attachments. My dilema is that i know the location of folder where the jpg files are. Is it possible by just supplying the folder path vba access can some how get all the files in that folder and attach it to outlook.

So far this is wat i got

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
'.To = emailadresses
'.CC = more emailadresses
'.Subject = "subject"
'.HTMLBody = ""
' .Attachments.Add "C:\My Documents\TMS_example.doc", olByValue, 1, "TMS_example.doc"
.Display
End With

cheers

 
try using wildcard characters...

attachment.add "path & \*.*
 
Or take a look at the Dir function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi i tried this and didn't work got error saying the system cannot find the path specified.

Attachments.Add "C:\Documents and Settings\macca\My Documents\test2 & \*.*"

to PHV could u show me sample code using the dir function

cheers

 
Something like this ?
myDir = "C:\Documents and Settings\macca\My Documents\test2\"
myFile = Dir(myDir & "*.*")
While myFile <> ""
Attachments.Add myDir & myFile
myFile = Dir()
WEnd

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top