Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Want to disable save and save as- SOLVED

  1. #1
    Board Regular
    Join Date
    May 2002
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

  2. #2
    MrExcel MVP lenze's Avatar
    Join Date
    Feb 2002
    Location
    Helena, MT
    Posts
    13,690
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Why not require a password to save?

  3. #3
    Board Regular
    Join Date
    May 2002
    Location
    Dallas
    Posts
    366
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  4. #4
    Board Regular
    Join Date
    May 2002
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

  5. #5
    Board Regular
    Join Date
    May 2002
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

  6. #6
    Board Regular
    Join Date
    Feb 2002
    Location
    Huntington Beach, CA USA
    Posts
    327
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  7. #7
    Board Regular
    Join Date
    May 2002
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for your time James. I think I know what that is supposed to do, however I'm doing something wrong.

  8. #8
    Board Regular
    Join Date
    Feb 2002
    Location
    Huntington Beach, CA USA
    Posts
    327
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  9. #9
    Board Regular
    Join Date
    May 2002
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

  10. #10
    Board Regular
    Join Date
    Feb 2002
    Location
    Huntington Beach, CA USA
    Posts
    327
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •