Results 1 to 4 of 4

Thread: outlook

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    I just tried to add .Attachments to an outlook object.

    Can anyone tell me what the correect syntax is?

    objOutlookMsg.Attachments = "C:\test.txt"

    raises the error "One or more parameters are incorrect"

    Thaks in advance etc.

    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

  2. #2
    Lively Member Ishamel's Avatar
    Join Date
    Nov 1999
    Location
    Edinburgh, Scotland
    Posts
    112

    Post

    Mark,

    I think this is what you are after. I've not tested it, so you might have to tweak it slightly.

    Code:
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olMailItem)
    Set myAttachments = myItem.Attachments
    myAttachments.Add "C:\Test.txt", _
        olByValue, 1, "Test File"

  3. #3

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Thanks for that Ishamel!


    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

  4. #4
    Lively Member Ishamel's Avatar
    Join Date
    Nov 1999
    Location
    Edinburgh, Scotland
    Posts
    112

    Post

    Here's what the help file has to say incase you need more info.

    Syntax - objAttachments.Add(Source, [Type], [Position], [DisplayName])

    objAttachments - Required. An expression that returns an Attachments collection object.

    Source - Required Variant. 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(4), olByValue(1), olEmbeddedItem(5), or olOLE(6).

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

    DisplayName - Optional String. The display name of the attachment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width