Name of new workbood in Msgbox

MarkCBB

Active Member
Joined
Apr 12, 2010
Messages
497
Hi there,


I am using the following code to export a staff database from its location to a new workbook, but I would like the msgbox at the end of the code to display the name of the Workbook, most times it will be "Book1" but just in case.

Code:
Sub Export_Staff_DB()
Dim STAFFDB As Range

Sheets("STAFF_DB").Visible = True
Sheets("STAFF_DB").Select
Range("A1:N1").Select
Range(Selection, Selection.End(xlDown)).Select
Set STAFFDB = Selection
STAFFDB.Copy
Workbooks.Add
Range("A1").Select
ActiveSheet.Paste
MsgBox ("Please save this copy, you are able to edit the contents, then when you are done please import the updated copy vai INPUT page! Thanks!")
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Yup I was forgetting the Active part.
Code:
MsgBox ("Please save this copy, " & ActiveWorkbook.Name & "  you are able to edit the contents, then when you are done please import the updated copy vai INPUT page! Thanks!")

Thanks James
 
Upvote 0

Forum statistics

Threads
1,224,542
Messages
6,179,421
Members
452,913
Latest member
JWD210

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