That is fine (and works) but I have written this in the This Workbook part of VBA and can't name the macro - would typing
Call Thisworkbook do the trick?
Could you post your code, please, as I don't quite get what you're driving at. The workbook open routine runs due to the workbook open event and therefore, by definition, should run before any other macros and shouldn't need to be called.
When the new sheet is opened I want to display my special offer Stop press window (this is a price I can send to customers)that will pop up before they see the whole work book - does this all make sense?
Think so . I'm presuming the message you want to show is in the workbook_open sub of the initial workbook, yes?
If so, go to the module in your post above and click on insert- procedure and name the procedure Macro 2, for example.
Go to your workbook_open sub and cut and paste the code in there (minus the workbook_open() and end sub bits) into the new Macro2 procedure. Add Call Macro2 to your Workbook_Open sub and add the same to your emailnew2 sub at the end.
Your code should now look like: -
Private Sub Workbook_Open()
Call Macro2
End Sub
And in the module: -
Sub emailnew2()
'
' emailnew2 Macro
' Macro recorded 3/7/2002 by Base-Displays
'
'
' .... all your code as above
Call Macro2
End Sub
Public Sub Macro2()
'your code
End Sub
Note that the code you have in Macro2 will not be propagated to the new workbook, however...
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.