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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

??? @ the add method of attachments object

Status
Not open for further replies.

Nick34

Technical User
Oct 16, 2003
50
US
I'm trying to send an access report to someone by pushing a button. It is output to a file already and I want outlook to add it as an attachment. My question is, what are the "source" and "type" arguments of this method!?!?!?

I am using the mailitme object of outlook.

PLEASE help..
 
Source Required String. The file (represented by the full path and file name) or item that constitutes the attachment.

Type Optional Long. The type of attachment. Can be one of the following OlAttachmentType constants:
olByReference, olByValue,
olEmbeddedItem, or olOLE. Without going into a long drawn discussion of these, in your case it would be olByValue

Position Optional Long. The position of the attachment within the body text of the message.

DisplayName Optional String. The display name of the attachment.

 
This is the code I am using, and I am getting the error message,"Expected:=" at the .attachments line.

ALSO, in the help file for the type it says it is a required string.

Set myOlApp = CreateObject("Outlook.application")
Set myRpt = myOlApp.CreateItem(olMailItem)

ChDir "G:\Environmental Services\Compliance\Air Compliance"

With myRpt

.To = "evannb@jea.com"
.Body = "Excess Emissions Notification"
.Attachments.Add("G:\Environmental Services\Compliance\Air Compliance\Emissions.rtf", olByValue)
.Display

End With
 
Here's one of mine:
objMailItem.Attachments.Add strCurrentFile, olByValue, 1, "MRP Regen Report"

Try getting rid of paranthesis, add number of attachments (1) and a title for attachment
 
I think I got it now. Thanks.

Do you know why my help file is giving me different instructions??? The 3rd argument from my help file is supposed to be a name, not the number of attachments.
 
Oh. I have 2000. No matter. It is working now anyway.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top