ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Create a message to 'pop open' (https://www.excelbanter.com/excel-discussion-misc-queries/139815-create-message-pop-open.html)

JoeP

Create a message to 'pop open'
 
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.


Mike

Create a message to 'pop open'
 
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

"JoeP" wrote:

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.


Mike

Create a message to 'pop open'
 
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

"JoeP" wrote:

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.



All times are GMT +1. The time now is 11:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com