Want to disable save and save as- SOLVED

dsnbld

Board Regular
Joined
May 7, 2002
Messages
206
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
a = MsgBox("Save Is Disabled", vbOKOnly)
If a = vbOK Then Cancel = True
End Sub

How do I get out of this file with my changes? Don't laugh.

**EDIT**
This what I ended up with:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ThisWorkbook.Saved = False Then
Msg = "Saving Changes Is Disabled In Evaluation Version"
Msg = MsgBox(Msg, vbOKOnly + vbExclamation)
Cancel = True
'Interupt here when saving this code for the first time. I type "bug" to interupt.
'Debug (delete bug) and reset- then save process will continue.
'In future you can set ThisWorkbook Saved property to True to save changes.
End If
End Sub
This message was edited by dsnbld on 2002-05-12 20:52
This message was edited by dsnbld on 2002-05-15 06:50
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
dsnbld -

You may be able to do this with a 'SaveAs' rather than a 'Save', but you would either have to rename the file, or save it into another directory. See if this does what you need it to.

~Thomas
 
Upvote 0
Thanks guys. I don't want the user to save or save as, and I really would prefer not having a password box pop-up.
I have an idea what might could be done, but I'm still learning and don't have the know-how to formulate it.
 
Upvote 0
Here's my idea. You need a password to save, but password option is only available if the VB window is open. ??
This message was edited by dsnbld on 2002-05-09 17:27
 
Upvote 0
Hi dsnbld,

Put this in your ThisWorkbook:

Private Sub Workbook(Cancel As Boolean)
Dim Msg As String, Ans As String
If Not Me.Saved Then
Msg = "application was not saved"
Msg = Msg & Me.Name & "?"
Ans = MsgBox(Msg, vbOKOnly + vbExclamation)
Me.Saved = True
Exit Sub
End If
End Sub

James
 
Upvote 0
Thanks for your time James. I think I know what that is supposed to do, however I'm doing something wrong.
 
Upvote 0
I don't know what your doing wrong. If you want, you can send me your file and i'll
try to fix it for you.

James
 
Upvote 0
Thanks James. I've created a nice template that needs some VB code, and although I had wanted to do it myself, I'm just not ready.
Is it against forum rules to solicite help for hire? I need some other code other than what you tried to help me with.
* User must enable macros or else workbook will not open
* Disable save as (what you helped me with). So that a user could evaluate the template. I would then send them a new template with save enabled when they decide to buy.
* Paste values only as a default for pasting.
* Font formatting in certain cells (while sheet protection is on), if this is possible.
 
Upvote 0
Hi dsnbld,

Everything you mentioned is very doable, and i'm sure someone will be interested in your offer, i choose not too, i've been helped by numerous people and never been asked for a fee,i see this board as all about learning, helping and sharing, not the $$$. Once it becomes all about $$$ the beauty of this board will be "**** up" > DEAD

A few of my teachers in no particular order:

Ivan F. Moala
Celia
Dave Hawley
Dax
Damon Ostrander "taught me,taught me,taught me"
Mark O/Brien
Juan Pablo G.
Ayladin "the master of formulae"

Send it to me, i want to help you no $$$ involved!
James

_________________
This message was edited by James on 2002-05-09 20:56
This message was edited by James on 2002-05-09 21:13
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,999
Members
448,541
Latest member
iparraguirre89

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top