PC Review


Reply
Thread Tools Rate Thread

Attaching more than one file to an email with VBA

 
 
Tom Joseph
Guest
Posts: n/a
 
      14th Feb 2009
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 With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      14th Feb 2009
Check if this file exist

--

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


"Tom Joseph" <(E-Mail Removed)> wrote in message news:0EC699AB-3C29-4938-B224-(E-Mail Removed)...
> 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 With Quote
 
Tom Joseph
Guest
Posts: n/a
 
      14th Feb 2009
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" <(E-Mail Removed)> wrote in message news:0EC699AB-3C29-4938-B224-(E-Mail Removed)...
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching a File to an email (via network) Jan Microsoft Outlook 15 25th Aug 2007 03:54 AM
Merging & attaching email -->file =?Utf-8?B?Q3V5bGVy?= Microsoft Outlook Discussion 1 16th Mar 2004 10:26 PM
Attaching file to email David Peters Microsoft Access 0 16th Feb 2004 07:03 AM
attaching file to email john Windows XP Networking 1 8th Jan 2004 12:20 AM
Attaching file to email TomSchleis Microsoft Outlook 0 17th Nov 2003 04:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:39 PM.