Outlook VBA add attachment

Dancey_

New Member
Joined
Aug 18, 2010
Messages
41
Hi guys,

Hope you can help as I couldn't find anywhere as helpful!

I am trying to achieve something very simple with VBA in Outlook but cant seem to crack it.

I need to be able to attached a file call it "C:\Users\tom.dance\Desktop\test.txt" for example

I have found how to create a new email, then add this attachment and send the email.

However, I just simply want to be able to add said attachment to an existing email (that is open) and do nothing more.

I cannot find how to refer to the open window, I need something like active workbook in excel.

Cheers
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hello Dancey,

you can use:

Code:
Sub wigi()
    ActiveInspector.CurrentItem.Attachments.Add "C:\Users\tom.dance\Desktop\test.txt"
End Sub
 
Upvote 0
Hi Wigi,

Your a star, I'll check it out once I have access to a PC a little bit later.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top