ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Disable the save button (https://www.excelbanter.com/excel-discussion-misc-queries/213106-disable-save-button.html)

leerem

Disable the save button
 
Hi,
I need to be able to force the user to save the spreadsheet by use of
VBA as opposed to useing the save button or using the File\ save in excel
2003 or Office button ect in excel 2007. This is so that i can keep the
original file as an empty form, and to ensure the file is saved in the
correct location.

many thanks
lee

Mike H

Disable the save button
 
Hi,

cancel the save event and call your save macro, something like this

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
mysave
End Sub

Sub mysave()
Application.EnableEvents = False
'do things and save

Application.EnableEvents = True
End Sub

Mike

"leerem" wrote:

Hi,
I need to be able to force the user to save the spreadsheet by use of
VBA as opposed to useing the save button or using the File\ save in excel
2003 or Office button ect in excel 2007. This is so that i can keep the
original file as an empty form, and to ensure the file is saved in the
correct location.

many thanks
lee


leerem

Disable the save button
 
Hi Mike,

I take the the first routine will have to be entered in the
ThisWorkbook ?

"Mike H" wrote:

Hi,

cancel the save event and call your save macro, something like this

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
mysave
End Sub

Sub mysave()
Application.EnableEvents = False
'do things and save

Application.EnableEvents = True
End Sub

Mike

"leerem" wrote:

Hi,
I need to be able to force the user to save the spreadsheet by use of
VBA as opposed to useing the save button or using the File\ save in excel
2003 or Office button ect in excel 2007. This is so that i can keep the
original file as an empty form, and to ensure the file is saved in the
correct location.

many thanks
lee


Jim Rech

Disable the save button
 
Workbook_BeforeSave has to go in ThisWorkbook. The other sub can go there
or in a standard module.

--
Jim
"leerem" wrote in message
...
| Hi Mike,
|
| I take the the first routine will have to be entered in the
| ThisWorkbook ?
|
| "Mike H" wrote:
|
| Hi,
|
| cancel the save event and call your save macro, something like this
|
| Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
| Cancel = True
| mysave
| End Sub
|
| Sub mysave()
| Application.EnableEvents = False
| 'do things and save
|
| Application.EnableEvents = True
| End Sub
|
| Mike
|
| "leerem" wrote:
|
| Hi,
| I need to be able to force the user to save the spreadsheet by
use of
| VBA as opposed to useing the save button or using the File\ save in
excel
| 2003 or Office button ect in excel 2007. This is so that i can keep
the
| original file as an empty form, and to ensure the file is saved in the
| correct location.
|
| many thanks
| lee


leerem

Disable the save button
 
many thanks Mike just what i needed
regards
Lee

"Mike H" wrote:

Hi,

cancel the save event and call your save macro, something like this

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
mysave
End Sub

Sub mysave()
Application.EnableEvents = False
'do things and save

Application.EnableEvents = True
End Sub

Mike

"leerem" wrote:

Hi,
I need to be able to force the user to save the spreadsheet by use of
VBA as opposed to useing the save button or using the File\ save in excel
2003 or Office button ect in excel 2007. This is so that i can keep the
original file as an empty form, and to ensure the file is saved in the
correct location.

many thanks
lee



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

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