ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Promt When Closing (https://www.excelbanter.com/excel-programming/372293-promt-when-closing.html)

TheRook

Promt When Closing
 
This may be an easy one but I am very new to Macros.

I would like a promt/Window/box, whatever tou call it to come on screen when
closing the spreadsheet reminding me to ensure that the worksheet is
protected.

Is this possible?

If I can go onestep further I would like it to appear when only certain
people cloes the spreadsheet.

regards

Tom Ogilvy

Promt When Closing
 
You would use the beforeclose event.

http://www.cpearson.com/excel/events.htm for an overview of events.

Environ("Username")

tells you the login id

demo'd from the immediate window:
? environ("Username")
OgilvyTW

--
Regards,
Tom Ogilvy


"TheRook" wrote:

This may be an easy one but I am very new to Macros.

I would like a promt/Window/box, whatever tou call it to come on screen when
closing the spreadsheet reminding me to ensure that the worksheet is
protected.

Is this possible?

If I can go onestep further I would like it to appear when only certain
people cloes the spreadsheet.

regards


stevebriz

Promt When Closing
 
here is an example

Dim wSheet As Worksheet
'MsgBox Environ("Username")
Select Case Environ("Username")
Case "Name1" ' user name of exempt from protect

Case "name2" 'user name of exempt from protect

Case Else
MsgBox "n"
Select Case MsgBox("Do you want to Protect all Sheets
before Closing?", vbYesNo)
Case vbYes
For Each wSheet In Worksheets
wSheet.Protect ' this is protect
without password
Next wSheet
Case vbNo
End Select
End Select

End Sub

TheRook wrote:
This may be an easy one but I am very new to Macros.

I would like a promt/Window/box, whatever tou call it to come on screen when
closing the spreadsheet reminding me to ensure that the worksheet is
protected.

Is this possible?

If I can go onestep further I would like it to appear when only certain
people cloes the spreadsheet.

regards




All times are GMT +1. The time now is 05:58 PM.

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