VBA excel outlook

anand_b6802

New Member
Joined
Apr 15, 2016
Messages
3
Hello guys,

i need to attach excel file to outlook via VBA.

example
A2-subject line
B2-mail id to
c2-mail id cc
D2-excel path which i want attach

in my VBA code wrote as
.attachment.add(range("D2").value

but above code doesn't working.

can any one tell me what would be code for attach excel file.

thank you in advance.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
If the file is the active workbook use
Code:
 .Attachments.Add ActiveWorkbook.FullName

otherwise, have a look here for code to create a temp file to add as an attachment
Refer to Example 1


Mail the whole workbook
 
Upvote 0
its not working.

I need to attached another file not the active excel file.
in marco file I have mentioned excel path which I want to attach.

pls guys tricks or code to attach excel file

Cell "B2" = H:\Working-anand\Anand_04.18.2016.xlsm
 
Upvote 0
Then use
Code:
 AttachFile = Sheets("YOURSHEETNAME").Range("D2").Value
 
'your mail code....and  then


 .Attachments.Add AttachFile
 
Upvote 0

Forum statistics

Threads
1,215,411
Messages
6,124,759
Members
449,187
Latest member
hermansoa

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