PC Review


Reply
Thread Tools Rate Thread

Code to move attachment and open excel workbook

 
 
=?Utf-8?B?QW5ndXM=?=
Guest
Posts: n/a
 
      11th Oct 2005
I have a bit experience in excel vba but none of outlook. Now i am looking
for a code: to move attachment to a specific folder and open an excel
workbook. Can any expert help?
 
Reply With Quote
 
 
 
 
Michael Bauer
Guest
Posts: n/a
 
      11th Oct 2005
Am Mon, 10 Oct 2005 19:31:02 -0700 schrieb Angus:

First you might want to ensure that the folder exists. This can be done
easily with the "Microsoft Scripting Runtime". Set a reference to the
library in your project and use its FileSystemObject. Then save the
attachment with its SaveAsFile method.

If you really want to "move" the attachment then you can it delete now from
the e-mail with Attachment.Delete.

For opening an Excel Workbook add a reference to Excel in your project and
use the Workbooks.Open function. A sample is available in the Excel VBA
help.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> I have a bit experience in excel vba but none of outlook. Now i am looking
> for a code: to move attachment to a specific folder and open an excel
> workbook. Can any expert help?

 
Reply With Quote
 
=?Utf-8?B?QW5ndXM=?=
Guest
Posts: n/a
 
      11th Oct 2005
Thanks for your reply... but I am really new for outlook codes, how to save
the attachment with its SaveAsFile method?

"Michael Bauer" wrote:

> Am Mon, 10 Oct 2005 19:31:02 -0700 schrieb Angus:
>
> First you might want to ensure that the folder exists. This can be done
> easily with the "Microsoft Scripting Runtime". Set a reference to the
> library in your project and use its FileSystemObject. Then save the
> attachment with its SaveAsFile method.
>
> If you really want to "move" the attachment then you can it delete now from
> the e-mail with Attachment.Delete.
>
> For opening an Excel Workbook add a reference to Excel in your project and
> use the Workbooks.Open function. A sample is available in the Excel VBA
> help.
>
> --
> Viele Gruesse / Best regards
> Michael Bauer - MVP Outlook
>
> > I have a bit experience in excel vba but none of outlook. Now i am looking
> > for a code: to move attachment to a specific folder and open an excel
> > workbook. Can any expert help?

>

 
Reply With Quote
 
Michael Bauer
Guest
Posts: n/a
 
      11th Oct 2005
Am Tue, 11 Oct 2005 02:02:03 -0700 schrieb Angus:

This saves all attachments of an opened e-mail:

Dim oAtt as Outlook.Attachment
Dim oMail as Outlook.MailItem
If TypeOf Application.ActiveInspector.CurrentItem is Outlook.MailItem Then
set oMail=Application.ActiveInspector.CurrentItem
For Each oAtt to oMail.Attachments
oAtt.SaveAsFile "YourPathHere"
Next
Endif


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> Thanks for your reply... but I am really new for outlook codes, how to

save
> the attachment with its SaveAsFile method?
>
> "Michael Bauer" wrote:
>
>> Am Mon, 10 Oct 2005 19:31:02 -0700 schrieb Angus:
>>
>> First you might want to ensure that the folder exists. This can be done
>> easily with the "Microsoft Scripting Runtime". Set a reference to the
>> library in your project and use its FileSystemObject. Then save the
>> attachment with its SaveAsFile method.
>>
>> If you really want to "move" the attachment then you can it delete now

from
>> the e-mail with Attachment.Delete.
>>
>> For opening an Excel Workbook add a reference to Excel in your project

and
>> use the Workbooks.Open function. A sample is available in the Excel VBA
>> help.
>>
>> --
>> Viele Gruesse / Best regards
>> Michael Bauer - MVP Outlook
>>
>>> I have a bit experience in excel vba but none of outlook. Now i am

looking
>>> for a code: to move attachment to a specific folder and open an excel
>>> workbook. Can any expert help?

>>

 
Reply With Quote
 
=?Utf-8?B?QW5ndXM=?=
Guest
Posts: n/a
 
      12th Oct 2005
Got it. Thanks.

"Michael Bauer" wrote:

> Am Tue, 11 Oct 2005 02:02:03 -0700 schrieb Angus:
>
> This saves all attachments of an opened e-mail:
>
> Dim oAtt as Outlook.Attachment
> Dim oMail as Outlook.MailItem
> If TypeOf Application.ActiveInspector.CurrentItem is Outlook.MailItem Then
> set oMail=Application.ActiveInspector.CurrentItem
> For Each oAtt to oMail.Attachments
> oAtt.SaveAsFile "YourPathHere"
> Next
> Endif
>
>
> --
> Viele Gruesse / Best regards
> Michael Bauer - MVP Outlook
>
> > Thanks for your reply... but I am really new for outlook codes, how to

> save
> > the attachment with its SaveAsFile method?
> >
> > "Michael Bauer" wrote:
> >
> >> Am Mon, 10 Oct 2005 19:31:02 -0700 schrieb Angus:
> >>
> >> First you might want to ensure that the folder exists. This can be done
> >> easily with the "Microsoft Scripting Runtime". Set a reference to the
> >> library in your project and use its FileSystemObject. Then save the
> >> attachment with its SaveAsFile method.
> >>
> >> If you really want to "move" the attachment then you can it delete now

> from
> >> the e-mail with Attachment.Delete.
> >>
> >> For opening an Excel Workbook add a reference to Excel in your project

> and
> >> use the Workbooks.Open function. A sample is available in the Excel VBA
> >> help.
> >>
> >> --
> >> Viele Gruesse / Best regards
> >> Michael Bauer - MVP Outlook
> >>
> >>> I have a bit experience in excel vba but none of outlook. Now i am

> looking
> >>> for a code: to move attachment to a specific folder and open an excel
> >>> workbook. Can any expert help?
> >>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can i send excel workbook as attachment form excel. Smart Akhtar Microsoft Excel Programming 1 26th Apr 2008 12:46 PM
Excel VBA - Send workbook as attachment - OS X cmhoz Webmaster / Programming 0 27th May 2007 04:51 AM
Open a sheet rename and move to another workbook Patrick Microsoft Excel Programming 16 19th Aug 2006 04:24 AM
Find and Open Workbook then copy and move sheet =?Utf-8?B?Y3dpbHNvbg==?= Microsoft Excel Programming 0 2nd Feb 2005 07:29 PM
need code to open new excel workbook ivan Microsoft Excel Programming 2 14th Sep 2004 02:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 AM.