Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Attaching more than one file to an email with VBA

Can someone please advise on the proper syntax for attaching more than one
file to a message?

The error occurs at:

.Attachments.Add FilenameStr2


Thanks,



Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

'On Error Resume Next
With OutMail
.To = emails
.CC = ""
.BCC = ""
.Subject = "Hourly TAT Performance: " & _
Worksheets("Labels").Cells(4, i).Value & " - " & _
Sheets("Main").Range("AB8").Value
.Body = "Reports attached"
' .BodyFormat = olFormatPlain 'testing for text format
.Attachments.Add FilenameStr
.Attachments.Add FilenameStr2
.Attachments.Add FilenameStr3
.Attachments.Add FilenameStr4
.Send 'or use .Display
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Attaching more than one file to an email with VBA

Check if this file exist

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Tom Joseph" wrote in message ...
Can someone please advise on the proper syntax for attaching more than one
file to a message?

The error occurs at:

.Attachments.Add FilenameStr2


Thanks,



Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

'On Error Resume Next
With OutMail
.To = emails
.CC = ""
.BCC = ""
.Subject = "Hourly TAT Performance: " & _
Worksheets("Labels").Cells(4, i).Value & " - " & _
Sheets("Main").Range("AB8").Value
.Body = "Reports attached"
' .BodyFormat = olFormatPlain 'testing for text format
.Attachments.Add FilenameStr
.Attachments.Add FilenameStr2
.Attachments.Add FilenameStr3
.Attachments.Add FilenameStr4
.Send 'or use .Display
End With

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Attaching more than one file to an email with VBA

Thanks Ron. I had the files renaming as the same file, so the attachement
instruction failed.


"Ron de Bruin" wrote:

Check if this file exist

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Tom Joseph" wrote in message ...
Can someone please advise on the proper syntax for attaching more than one
file to a message?

The error occurs at:

.Attachments.Add FilenameStr2


Thanks,



Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

'On Error Resume Next
With OutMail
.To = emails
.CC = ""
.BCC = ""
.Subject = "Hourly TAT Performance: " & _
Worksheets("Labels").Cells(4, i).Value & " - " & _
Sheets("Main").Range("AB8").Value
.Body = "Reports attached"
' .BodyFormat = olFormatPlain 'testing for text format
.Attachments.Add FilenameStr
.Attachments.Add FilenameStr2
.Attachments.Add FilenameStr3
.Attachments.Add FilenameStr4
.Send 'or use .Display
End With


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching an Excel File to an Email billbrandi Excel Discussion (Misc queries) 2 May 25th 09 01:22 PM
Attaching an Outlook email into a cell Joanne R Excel Discussion (Misc queries) 0 December 15th 08 11:17 PM
Closing and attaching spreadsheet to an email caddy Excel Programming 3 February 23rd 06 06:00 PM
Attaching One Worksheet to Email KeshnerH Excel Programming 1 January 26th 05 07:27 PM
attaching tabs to email please help Excel Discussion (Misc queries) 3 January 19th 05 07:50 PM


All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"