View Single Post
  #4  
Old June 29th 09, 05:26 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Add Multiple Attachments Sources using VBA in Word

This is still all one statement, because of the underscore continuation
characters at the end of the first four lines.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"JBark" wrote in message
...
Yes - I had tried that also like this, but I'm still getting syntax error.

.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _
.Attachments.Add Source:=ActiveDocument.TextBox("TextBoxFile1").Res ult,
Type:=olByValue, _
.Attachments.Add Source:=ActiveDocument.TextBox("TextBoxFile2").Res ult,
Type:=olByValue, _
.Attachments.Add Source:=ActiveDocument.TextBox("TextBoxFile3").Res ult,
Type:=olByValue, _
.Attachments.Add Source:=ActiveDocument.TextBox("TextBoxFile4").Res ult,
Type:=olByValue
.Send

"Sue Mosher [MVP]" wrote:

You need a separate .Attachments.Add statement for each attachment, not
one
long statement with multiple calls to the .Add method.

"JBark" wrote in message
...
Hi,

How can this code be written to add multiple attachments using vba and
Word
as my email editor. The first attachment is the active document itself,
the
other 4 attachments have their full path names stored in a field in the
document. This is what I have but I'm getting a syntax error and I'm
not
sure
why. Any suggestions are greatly appreciated.


.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _
.Add Source:=ActiveDocument.TextBox("TextBoxFile1").Res ult,
Type:=olByValue, _
.Add Source:=ActiveDocument.TextBox("TextBoxFile2").Res ult,
Type:=olByValue, _
.Add Source:=ActiveDocument.TextBox("TextBoxFile3").Res ult,
Type:=olByValue, _
.Add Source:=ActiveDocument.TextBox("TextBoxFile4").Res ult,
Type:=olByValue
.Send







Ads