|
-
May 31st, 2005, 06:51 AM
#1
Thread Starter
Hyperactive Member
Using VBA to disable Excel save function?
Is it possible to use VBA to disable the Save andSave As... functions in Excel for a particular application?
I was thinking of something like this, placed in the ThisWorkbook VBA module:
Code:
On ApplicationSave
MsgBox "Application cannot be saved"
Close Workbook
I am not sure of the exact syntax but basically that describles what I want to do. Would this work, or is there a better way of doing it?
Thanks
-Rob
http://www.sudsolutions.com
-
May 31st, 2005, 07:03 AM
#2
Re: Using VBA to disable Excel save function?
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel as Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
End Sub
this should work, just set cancel = true
pete
-
May 31st, 2005, 11:02 AM
#3
Thread Starter
Hyperactive Member
Re: Using VBA to disable Excel save function?
That seems to do the trick, thanks.
Is is possible to do something similar with the Print function? I.e. disable it for that workbook. My app. has a report generation feature that I also want to be able to disable for the trial version.
I've tried altering what you posted for the Save function so that it works for the Print function as well but not had any luck.
Thanks
-Rob
http://www.sudsolutions.com
-
May 31st, 2005, 11:06 AM
#4
Re: Using VBA to disable Excel save function?
Private Sub Workbook_BeforePrint(Cancel As Boolean)
For Each wk in Worksheets
wk.Calculate
Next
End Sub
make cancel = true
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|