Create a message to 'pop open'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to know the code for use in a macro that will cause a Message to
'pop open' when I click on to another sheet, or close the file. The message
would read something like 'Before proceeding do you want to protect the
sheet?'

Thanks for any help.
 
Paste this into the Thisworkbook Module

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim strmsg As String

strmsg = ActiveSheet.Name & vbCrLf & "Would you like to Protect Sheet"
MsgBox strmsg
End Sub
 
Paste both oh these into thisworkbook module
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim strmsg As String

strmsg = "Before proceeding would you like to protect" _
& vbCrLf & ActiveSheet.Name
MsgBox strmsg
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim strmsg As String

strmsg = "Before proceeding would you like to protect" _
& vbCrLf & ActiveSheet.Name
MsgBox strmsg

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top