Outlook MailItem.Attachments.Add method, Position Parameter 
Author Message
 Outlook MailItem.Attachments.Add method, Position Parameter

I am trying to use the Outlook mailitem object to autogenerate an email
and send it out.  I have everything working except the positioning of
the attachment is kind of weird.  There is a position parameter for the
Attachments.Add method , but the help file only states that the position
property is of type long.  It does not give a description of how the
property is interpreted into a screen location.  Does anyone have the
info I need to interpret this property.

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

Syntax

expression.Add(Source, Type, Position, DisplayName)

expression   An expression that returns an Attachments object.
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.
Position   Optional Long. The position of the attachment within the body
text of the message.
DisplayName   Optional String. The display name of the attachment.

Sincerely,
Dave Burt



Tue, 06 Feb 2001 03:00:00 GMT  
 Outlook MailItem.Attachments.Add method, Position Parameter

I am trying to use the Outlook mailitem object to autogenerate an email
and send it out.  I have everything working except the positioning of
the attachment is kind of weird.  There is a position parameter for the
Attachments.Add method , but the help file only states that the position
property is of type long.  It does not give a description of how the
property is interpreted into a screen location.  Does anyone have the
info I need to interpret this property.

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

Syntax

expression.Add(Source, Type, Position, DisplayName)

expression   An expression that returns an Attachments object.
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.
Position   Optional Long. The position of the attachment within the body
text of the message.
DisplayName   Optional String. The display name of the attachment.

Sincerely,
Dave Burt



Tue, 06 Feb 2001 03:00:00 GMT  
 Outlook MailItem.Attachments.Add method, Position Parameter
Hi David,

Any specific reason why you want to insert at a specific position?  I've
used 0 and it works just fine.

    With mobjNewMessage
        .Text = " " & mobjNewMessage.Text
        Set objAttachment = .Attachments.Add
        With objAttachment
            .Position = 0
            .Name = stLabel
            'no need to link a file me thinks
            .Type = CdoFileData
            .ReadFromFile stFile
        End With
        .Update
    End With

Also, if you check out the References/Downloads section at the website in my
sig., the MAPIstuff.zip might help some.

HTH
--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------


    I am trying to use the Outlook mailitem object to autogenerate an email
and send it out.  I have everything working except the positioning of the
attachment is kind of weird.  There is a position parameter for the
Attachments.Add method , but the help file only states that the position
property is of type long.  It does not give a description of how the
property is interpreted into a screen location.  Does anyone have the info I
need to interpret this property.
    Creates a new attachment in the Attachments collection, and returns the
new attachment as an Attachment object.

    Syntax

    expression.Add(Source, Type, Position, DisplayName)

    expression   An expression that returns an Attachments object.
    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.
    Position   Optional Long. The position of the attachment within the body
text of the message.
    DisplayName   Optional String. The display name of the attachment.

    Sincerely,
    Dave Burt



Tue, 06 Feb 2001 03:00:00 GMT  
 Outlook MailItem.Attachments.Add method, Position Parameter
I thought it would look better if the attachment was at the end of the message
rather than the beginning.  I discovered that the position relates to how many
characters into the message the attachment will appear.  The attachment cannot
be located past the end of the position.  So I appended a vbCrLf and a few
spaces, calculated the length of the body text, and set the position to one less
than the length of the body.  Voila, the attachment appears at the end.  Maybe
using a position of 0 will accomplish the same (I only tried positive numbers >
0).

Sincerely,
Dave

Quote:

> Hi David,

> Any specific reason why you want to insert at a specific position?  I've
> used 0 and it works just fine.

>     With mobjNewMessage
>         .Text = " " & mobjNewMessage.Text
>         Set objAttachment = .Attachments.Add
>         With objAttachment
>             .Position = 0
>             .Name = stLabel
>             'no need to link a file me thinks
>             .Type = CdoFileData
>             .ReadFromFile stFile
>         End With
>         .Update
>     End With

> Also, if you check out the References/Downloads section at the website in my
> sig., the MAPIstuff.zip might help some.

> HTH
> --
> Dev Ashish (Just my $.001)
> ---------------
> The Access Web ( http://home.att.net/~dashish )
> ---------------


>     I am trying to use the Outlook mailitem object to autogenerate an email
> and send it out.  I have everything working except the positioning of the
> attachment is kind of weird.  There is a position parameter for the
> Attachments.Add method , but the help file only states that the position
> property is of type long.  It does not give a description of how the
> property is interpreted into a screen location.  Does anyone have the info I
> need to interpret this property.
>     Creates a new attachment in the Attachments collection, and returns the
> new attachment as an Attachment object.

>     Syntax

>     expression.Add(Source, Type, Position, DisplayName)

>     expression   An expression that returns an Attachments object.
>     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.
>     Position   Optional Long. The position of the attachment within the body
> text of the message.
>     DisplayName   Optional String. The display name of the attachment.

>     Sincerely,
>     Dave Burt




Wed, 07 Feb 2001 03:00:00 GMT  
 Outlook MailItem.Attachments.Add method, Position Parameter
Dave:

No position 0 would put it at the start of the message.  You've done it the
write way, although you can put the postion as being past the length of the
message too.

HTH

Steve Arbaugh
ATTAC Consulting Group
web: http://ourworld.compuserve.com/homepages/attac-cg/acgsoft.htm
To reply, remove ~ and nospm from address

Quote:

>I thought it would look better if the attachment was at the end of the
message
>rather than the beginning.  I discovered that the position relates to how
many
>characters into the message the attachment will appear.  The attachment
cannot
>be located past the end of the position.  So I appended a vbCrLf and a few
>spaces, calculated the length of the body text, and set the position to one
less
>than the length of the body.  Voila, the attachment appears at the end.
Maybe
>using a position of 0 will accomplish the same (I only tried positive
numbers >
>0).

>Sincerely,
>Dave


>> Hi David,

>> Any specific reason why you want to insert at a specific position?  I've
>> used 0 and it works just fine.

>>     With mobjNewMessage
>>         .Text = " " & mobjNewMessage.Text
>>         Set objAttachment = .Attachments.Add
>>         With objAttachment
>>             .Position = 0
>>             .Name = stLabel
>>             'no need to link a file me thinks
>>             .Type = CdoFileData
>>             .ReadFromFile stFile
>>         End With
>>         .Update
>>     End With

>> Also, if you check out the References/Downloads section at the website in
my
>> sig., the MAPIstuff.zip might help some.

>> HTH
>> --
>> Dev Ashish (Just my $.001)
>> ---------------
>> The Access Web ( http://home.att.net/~dashish )
>> ---------------


>>     I am trying to use the Outlook mailitem object to autogenerate an
email
>> and send it out.  I have everything working except the positioning of the
>> attachment is kind of weird.  There is a position parameter for the
>> Attachments.Add method , but the help file only states that the position
>> property is of type long.  It does not give a description of how the
>> property is interpreted into a screen location.  Does anyone have the
info I
>> need to interpret this property.
>>     Creates a new attachment in the Attachments collection, and returns
the
>> new attachment as an Attachment object.

>>     Syntax

>>     expression.Add(Source, Type, Position, DisplayName)

>>     expression   An expression that returns an Attachments object.
>>     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.
>>     Position   Optional Long. The position of the attachment within the
body
>> text of the message.
>>     DisplayName   Optional String. The display name of the attachment.

>>     Sincerely,
>>     Dave Burt




Mon, 12 Feb 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Outlook MailItem.Attachments.Add method, Position Parameter

2. Add attachment from item in folder to MailItem

3. Help with MailItem.Attachments.add()

4. Properties and Methods For Outlook MailItem

5. Reply method of outlook.mailitem object

6. Invoking Outlook Express from VB (Attachment parameter not evaluated)

7. Adding an OLE attachment to an Outlook item

8. Add attachments linked to elements of the outlook folder system

9. Adding attachment in Outlook: Can this be done?

10. I want to add attachments to emails in outlook

11. Moving an attached outlook message into a Outlook MailItem object with VB/VBA

12. mailitem attachments

 

 
Powered by phpBB® Forum Software