Get file name for email body reference

justme

Well-known Member
Joined
Aug 26, 2002
Messages
729
I wold like to reference the Active Workbook file name in the body of the email I am sending out from a button. The sentence is telling people to go to a network location and lookup the name of a file. This is being placed in a worksheet that will be used by many different people. I only need to capture the file name, not the location.

Thanks in advance.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Variable not defined???

I put your code under the Dim statements in the module. Then I added & vName outside the quotes in the sentence. I got the error message mentioned above.

the code looks like:

Under the Dim statements I added
vName = ActiveWorkbook.Name


.body = "Dear "
"Please go to this location blah blah " & vName

What is wrong?
 
Upvote 0
Did you "Dim vName As String"?? Please post all your code.

I'd assume off hand (without seeing your code) at the top of your code you have 'Option Explicit' and that means you must declare all your variables.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,003
Members
448,935
Latest member
ijat

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