Friday, 6 September 2013

Code a message box when a workbook is selected

Code a message box when a workbook is selected

I would like to make a macro so when the workbook is opened or when it
becomes active (meaning that its not active when its running in the
background but the user is working in another workbook or in another
application) there comes a dialog box with a customized warning message.
Ideally the code would look something like this and would be in the
ThisWorkbook Object code:
Sub warningmsg()
Dim wb As Workbook
Set wb as This.Workbook
If wb.first.mouseclick <> True
Then
MsgBox "Warning, this workbook is HOT"
end sub
How is this possible in Excel VBA?

No comments:

Post a Comment