+ Reply to Thread
Results 1 to 8 of 8

Disabling SaveAs and Save?

Hybrid View

  1. #1
    Bob Phillips
    Guest

    Re: Disabling SaveAs and Save?

    As I mentioned, I added a variable to allow you to do that through code.

    In a standard code module, declare the variable at the start

    Public fSave As Boolean

    Then add a simple save macro

    Sub Private SaveMyWB()

    fSave = True
    ThisWorkbOkk.SaveAs "myFilename.xls" '<==== Change to suit
    fSave = False

    End Sub

    I made it private so that it doesn't show in the list of macros from Excel.
    Run it from the VBIDE by setting the cursor within the macro and the F5, or
    call it in the immediate window.
    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Petitboeuf" <Petitboeuf.2aispn_1152183302.3181@excelforum-nospam.com> wrote
    in message news:Petitboeuf.2aispn_1152183302.3181@excelforum-nospam.com...
    >
    > Bob
    >
    > Thank you very much! It does work!!
    >
    > Well... so much so that... how do i save my workbook with the module in
    > AFTER pasting it?!
    >
    >
    > --
    > Petitboeuf
    > ------------------------------------------------------------------------
    > Petitboeuf's Profile:

    http://www.excelforum.com/member.php...o&userid=10602
    > View this thread: http://www.excelforum.com/showthread...hreadid=558792
    >




  2. #2
    Registered User
    Join Date
    06-14-2004
    Posts
    75
    Bob

    I am so sorry to bother you again but... well I'm no expert and still trying real hard to understand that VB thingy

    So far i have done the following:

    1. in the ThisWorkbook code in General I have the Private Sub Workbook_BeforeSave pasted

    2. in the same location I have the Public Sub SaveMyWB pasted

    3. I do not know where to put the Public fSave As Boolean as it doesn't seem to stand alone...


    Damn it's hard to be thick!

  3. #3
    Bob Phillips
    Guest

    Re: Disabling SaveAs and Save?

    Put 2 and 3 in a standard code module (Insert>Module)

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Petitboeuf" <Petitboeuf.2aiyyo_1152191407.235@excelforum-nospam.com> wrote
    in message news:Petitboeuf.2aiyyo_1152191407.235@excelforum-nospam.com...
    >
    > Bob
    >
    > I am so sorry to bother you again but... well I'm no expert and still
    > trying real hard to understand that VB thingy
    >
    > So far i have done the following:
    >
    > 1. in the ThisWorkbook code in General I have the Private Sub
    > Workbook_BeforeSave pasted
    >
    > 2. in the same location I have the Public Sub SaveMyWB pasted
    >
    > 3. I do not know where to put the Public fSave As Boolean as it doesn't
    > seem to stand alone...
    >
    >
    > Damn it's hard to be thick!
    >
    >
    > --
    > Petitboeuf
    > ------------------------------------------------------------------------
    > Petitboeuf's Profile:

    http://www.excelforum.com/member.php...o&userid=10602
    > View this thread: http://www.excelforum.com/showthread...hreadid=558792
    >




  4. #4
    Registered User
    Join Date
    06-14-2004
    Posts
    75
    Thank you very much.

    Out of interest why does it work if in a Module instead of on a sheet?

  5. #5
    Bob Phillips
    Guest

    Re: Disabling SaveAs and Save?

    It probably would if you put everything in the worksheet module, including
    the Public variable, but you would not be able to call it from the Excel
    macro list.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Petitboeuf" <Petitboeuf.2aizvz_1152192602.4698@excelforum-nospam.com> wrote
    in message news:Petitboeuf.2aizvz_1152192602.4698@excelforum-nospam.com...
    >
    > Thank you very much.
    >
    > Out of interest why does it work if in a Module instead of on a sheet?
    >
    >
    > --
    > Petitboeuf
    > ------------------------------------------------------------------------
    > Petitboeuf's Profile:

    http://www.excelforum.com/member.php...o&userid=10602
    > View this thread: http://www.excelforum.com/showthread...hreadid=558792
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1