send *.* files to outlook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Question:
I need to send 5 by mail 5 files that are inside a folder in any place in
the computer. This files changes their names so the code must let me send
the context ofe the folder. The code to sen a file es like this, but don´t
want to specify the names just all the files inside this folder. Please help
me.
..Attachments.Add ("Z:\folderxxx\file1.XLS")
I need something like this:
..Attachments.Add ("Z:\folderxxx\*.XLS")
Thanks
 
Is this "code" being written inside a Microsoft Access database?

This is an ACCESS newsgroup.
 
yes, inside a module it goes like this.

Sub Mail_workbooks_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.BCC = "(e-mail address removed)"
.Subject = "test of transmition"
.Body = "attached all the files indise the folder"
.Attachments.Add ("Z:\ViaExp\BIT.XLS")
.Attachments.Add ("Z:\ViaExp\*.XLS")
.display 'or use .Display

End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

So you see, I don't want to specify a file I need to send all the files
inside the folder. Thanks
 
mariagloria said:
yes, inside a module it goes like this.

Sub Mail_workbooks_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.BCC = "(e-mail address removed)"
.Subject = "test of transmition"
.Body = "attached all the files indise the folder"
.Attachments.Add ("Z:\ViaExp\BIT.XLS")
.Attachments.Add ("Z:\ViaExp\*.XLS")
.display 'or use .Display

End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

So you see, I don't want to specify a file I need to send all the
files inside the folder. Thanks

It looks like you need something like this:

Dim strFile As String

' ...
strFile = Dir("Z:\ViaExp\*.XLS")
While Len(strFile) > 0
.Attachments.Add strFile
strFile = Dir()
Wend
' ...
 
Back
Top