Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   attach file with automation in Outlook (http://www.outlookbanter.com/outlook-vba/48128-attach-file-automation-outlook.html)

huub van helderen May 12th 07 09:52 AM

attach file with automation in Outlook
 
My program;

#define mailitem 0
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(mailitem)
WITH oEmailItem
])
.Subject = [TEST]
.cc=[ ]
.Importance=1
.Body = [ ] ??????? && here i need to attach a file *.msg or *.dot
ENDWITH
release oEmailItem,oOutLookObject,pcTekst,pcOnderwerp


What's the problem ?

I want to attach a file in outlook with a program, my program works but it's
only send tekst to Outlook. So I think I need another statement in place of
".body"
I need to send files *.msg or Outlook template files.
I looked everywhere, burt I can't find a solution.
So i will be very pleased if someone could help me.
--
huub

Sue Mosher [MVP-Outlook] May 12th 07 01:25 PM

attach file with automation in Outlook
 
You must not have used the object browser (F2 in VBA) or Outlook developer Help to look this up. If you had, you would have seen the Attachments collection:

.Attachments.Add c:\myfile.msg, 1

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"huub van helderen" wrote in message ...
My program;

#define mailitem 0
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(mailitem)
WITH oEmailItem
])
.Subject = [TEST]
.cc=[ ]
.Importance=1
.Body = [ ] ??????? && here i need to attach a file *.msg or *.dot
ENDWITH
release oEmailItem,oOutLookObject,pcTekst,pcOnderwerp


What's the problem ?

I want to attach a file in outlook with a program, my program works but it's
only send tekst to Outlook. So I think I need another statement in place of
".body"
I need to send files *.msg or Outlook template files.
I looked everywhere, burt I can't find a solution.
So i will be very pleased if someone could help me.
--
huub


huub van helderen May 14th 07 10:03 AM

attach file with automation in Outlook
 
I,ve seen it, but i don't want to send it as an attatchment but I need a
solution to place a file as contents in the body (JPG MSG or DOT template
file), in other words
I think I need a statement like .bodyinsert or something like that.

Thanks for response

--
huub


"Sue Mosher [MVP-Outlook]" wrote:

You must not have used the object browser (F2 in VBA) or Outlook developer Help to look this up. If you had, you would have seen the Attachments collection:

.Attachments.Add c:\myfile.msg, 1

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"huub van helderen" wrote in message ...
My program;

#define mailitem 0
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(mailitem)
WITH oEmailItem
])
.Subject = [TEST]
.cc=[ ]
.Importance=1
.Body = [ ] ??????? && here i need to attach a file *.msg or *.dot
ENDWITH
release oEmailItem,oOutLookObject,pcTekst,pcOnderwerp


What's the problem ?

I want to attach a file in outlook with a program, my program works but it's
only send tekst to Outlook. So I think I need another statement in place of
".body"
I need to send files *.msg or Outlook template files.
I looked everywhere, burt I can't find a solution.
So i will be very pleased if someone could help me.
--
huub



Sue Mosher [MVP-Outlook] May 14th 07 12:25 PM

attach file with automation in Outlook
 
If you didn't want to send an attachment, then why did you say "I want to attach a file."

The techniques used to insert content from a file into the body of the message vary with the content. For a .jpg image, see http://www.outlookcode.com/d/code/htmlimg.htm. For an .msg file, use the Application.CreateItem from template method. For a .dot Word template, use Word's Application.Documents.Add method to create a new document from the template and then use the technique shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to use that document to create a message body.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"huub van helderen" wrote in message ...
I,ve seen it, but i don't want to send it as an attatchment but I need a
solution to place a file as contents in the body (JPG MSG or DOT template
file), in other words
I think I need a statement like .bodyinsert or something like that.

Thanks for response

--
huub


"Sue Mosher [MVP-Outlook]" wrote:

You must not have used the object browser (F2 in VBA) or Outlook developer Help to look this up. If you had, you would have seen the Attachments collection:

.Attachments.Add c:\myfile.msg, 1



"huub van helderen" wrote in message ...
My program;

#define mailitem 0
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(mailitem)
WITH oEmailItem
])
.Subject = [TEST]
.cc=[ ]
.Importance=1
.Body = [ ] ??????? && here i need to attach a file *.msg or *.dot
ENDWITH
release oEmailItem,oOutLookObject,pcTekst,pcOnderwerp


What's the problem ?

I want to attach a file in outlook with a program, my program works but it's
only send tekst to Outlook. So I think I need another statement in place of
".body"
I need to send files *.msg or Outlook template files.
I looked everywhere, burt I can't find a solution.
So i will be very pleased if someone could help me.
--
huub



huub van helderen May 15th 07 09:13 PM

attach file with automation in Outlook
 
Sorry Sue, it must be my poor English, but still I thank you for your help.
--
huub


"Sue Mosher [MVP-Outlook]" wrote:

If you didn't want to send an attachment, then why did you say "I want to attach a file."

The techniques used to insert content from a file into the body of the message vary with the content. For a .jpg image, see http://www.outlookcode.com/d/code/htmlimg.htm. For an .msg file, use the Application.CreateItem from template method. For a .dot Word template, use Word's Application.Documents.Add method to create a new document from the template and then use the technique shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to use that document to create a message body.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"huub van helderen" wrote in message ...
I,ve seen it, but i don't want to send it as an attatchment but I need a
solution to place a file as contents in the body (JPG MSG or DOT template
file), in other words
I think I need a statement like .bodyinsert or something like that.

Thanks for response

--
huub


"Sue Mosher [MVP-Outlook]" wrote:

You must not have used the object browser (F2 in VBA) or Outlook developer Help to look this up. If you had, you would have seen the Attachments collection:

.Attachments.Add c:\myfile.msg, 1



"huub van helderen" wrote in message ...
My program;

#define mailitem 0
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(mailitem)
WITH oEmailItem
])
.Subject = [TEST]
.cc=[ ]
.Importance=1
.Body = [ ] ??????? && here i need to attach a file *.msg or *.dot
ENDWITH
release oEmailItem,oOutLookObject,pcTekst,pcOnderwerp


What's the problem ?

I want to attach a file in outlook with a program, my program works but it's
only send tekst to Outlook. So I think I need another statement in place of
".body"
I need to send files *.msg or Outlook template files.
I looked everywhere, burt I can't find a solution.
So i will be very pleased if someone could help me.
--
huub




All times are GMT +1. The time now is 06:09 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com