Results 1 to 8 of 8

Thread: Object Attachment - James (Again ) *RESOLVED*

  1. #1

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627

    Object Attachment - James (Again ) *RESOLVED*

    Using the MAPI controls I added
    VB Code:
    1. objAttachment.Position = 0
    That kept the attachment from appearing on the mail message, it put it in the paperclip thingie in Outlook. So, my question is this, using the Outlook objects instead of MAPI (henceforth referred to as CRAPI MAPI), this method does not work (not supported) and without a line like this, the attached file shows up on the message itself with all my admin information. Is there another action that will keep the file from appearing inline and put it in the paperclip deal?

    Thanks in advance.
    Last edited by demotivater; Oct 2nd, 2002 at 12:16 PM.

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Dman, I'm stumped on this.

    I will see if I can figure something out though. You want this for Outlook or Express?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    More Info on attachments :

    Using the Attachments Collection

    Use the Attachments property to return the Attachments collection for any Outlook item (except notes).

    Use the Add method to add an attachment to an item.

    To ensure consistent results, always save an item before adding or removing objects in the Attachments collection of the item.

    The following Visual Basic for Applications example creates a new mail message, attaches a Q496.xls as an attachment (not a link), and gives the attachment a descriptive caption.

    VB Code:
    1. Set myOlApp = CreateObject("Outlook.Application")
    2. Set myItem = myOlApp.CreateItem(olMailItem)
    3. myItem.Save
    4. Set myAttachments = myItem.Attachments
    5. myAttachments.Add "C:\My Documents\Q496.xls", _
    6.     olByValue, 1, "4th Quarter 1996 Results Chart"
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Perhaps this ?

    Add Method (Attachments Collection)

    Creates a new attachment in the Attachments collection, and returns the new attachment as an Attachment object.

    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), or olEmbeddedItem(5).

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

    DisplayName Optional String. The display name of the attachment. Ignored unless Type is set to olByValue.

    Remarks

    The following table describes the purpose of each OlAttachmentType constant value.

    Constant Use to
    olByReference Create a shortcut to an external file
    olByValue Embed attachment in the item
    olEmbeddedItem Create a shortcut to an Outlook item


    When an Attachment is added to the Attachments collection of an item, the Type property of the Attachment will always return olOLE(6) until the item is saved.

    To ensure consistent results, always save an item before adding or removing objects in the Attachments collection of the item.
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  5. #5

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    OK -
    I had this and couldn't get the position to work --

    VB Code:
    1. Set objAttachments = objNewMessage.Attachments
    2.  
    3.     'add attachment per vendor
    4.     Select Case vendor
    5.         Case "Graybar"
    6.             objAttachments.Add ("\\fs-1\dump\graybar\archive\" & outFile)
    7.         Case "Rexel-United"
    8.             objAttachments.Add ("\\fs-1\dump\united\archive\" & outFile)
    9.         Case "French-Gerleman"
    10.             objAttachments.Add ("\\fs-1\dump\french\archive\" & outFile)
    11.     End Select

    So, I changed it to the following and it works fine. *whew*

    VB Code:
    1. 'add attachment per vendor
    2.     Select Case vendor
    3.         Case "Graybar"
    4.             source = ("\\fs-1\dump\graybar\archive\" & outFile)
    5.         Case "Rexel-United"
    6.             source = ("\\fs-1\dump\united\archive\" & outFile)
    7.         Case "French-Gerleman"
    8.             source = ("\\fs-1\dump\french\archive\" & outFile)
    9.     End Select
    10.    
    11.     Set objAttachments = objNewMessage.Attachments.Add(source)
    12.     objAttachments.Position = 0

    Thanks for the help, James!

  6. #6
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    So it's resolved?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  7. #7

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    Yes, and dammit, I forgot to edit the subject line, doing it now.

  8. #8
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Glad you got it to work. Wasn't sure myself how to do it, until now...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

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