MrExcel Publishing
Your One Stop for Excel Tips & Solutions

How to disable 'save as' hotkey function...


Posted by JooBow on January 25, 2001 5:51 AM

I can disable the save as icon but the user
still can use tha hotkey function(shortcut)
via F12..is there any code to prevent user
to use this hotkey(shortcut) function?

ps : the user still can use the 'save'
function (Ctrl+S)


Thanks


Posted by JAF on January 25, 2001 7:53 AM

JB

A useful bit of code that I use myself on several workbooks - the code must be placed in the ThisWorkbook object.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI Then
MsgBox "The 'Save As' function has been disabled." & Chr(10) & "Only 'Save' will work.", vbInformation, "Save As Disabled"
Cancel = True
End If
End Sub

Hope this helps.

JAF.


Posted by JooBow on January 25, 2001 8:04 AM

Its not working JAF.could you fixed the code

ps: I'm using Excel97

Thanks


Posted by JAF on January 30, 2001 7:52 AM

I've checked the code and it works fine on Excel 2000 (unable to check on Excel 97).

Have you put the code in the ThisWorkbook object or just pasted it into a normal module? The code MUST bein the ThisWorkbook object (in the Visual Basic Explorer, select View-Project Eplorer, then expand Microsoft Excel Objects, double click ThisWorkbook and paste the code into the window that opens.

JAF

Its not working JAF.could you fixed the code ps: I'm using Excel97 Thanks

: JB : A useful bit of code that I use myself on several workbooks - the code must be placed in the ThisWorkbook object. : Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) : If SaveAsUI Then : MsgBox "The 'Save As' function has been disabled." & Chr(10) & "Only 'Save' will work.", vbInformation, "Save As Disabled" : Cancel = True : End If : End Sub : Hope this helps. : JAF.