close

Hi

is there anyway i can set up a workbook so that it automaically saves
when you close it (every time)?

also, can i password protect closing a workbook so that you need to put
a password in to close the file?

thanks

rufusf--
rufusf

The following event procedure will prompt for a password. If the
password is correct, it will save the file and then close. Else it will
cancel the closing process.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
myStr = InputBox(quot;Password required for closingquot;)
If myStr = quot;my set passwordquot; Then
Me.Save
Else
Cancel = True
End If
End Sub

To install:
Alt F11 to go to the VBA IDE
In the Project Explorer (top-left subwindow) double-click the
ThisWorkbook icon.
In the code page that appears paste the code above.

HTH
Kostis Vezerides
thank you very much - I will give this a try--
rufusf

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()