Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Save to act as SaveAs (Office 2000 Word 2000)

    Hi,

    When I click the Save As tool button in the std toolbar or File/Save As, I can get my macros to start a procedure which does more than just save the document with an other name. I have used a procedure called "Sub FileSaveAs()" in which I can put my code.

    When the document(file) has status "ReadOnly" and I click File/Save, the "Save As" disalog box appears as expected, but I cannot find any way to start my procedure as I can by using "Sub FileSaveAs()".

    I cannot name a procedure as "Sub FileSave()". it looks as it is not possible.

    Can anyone help me??

    Regards
    Bj

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Save to act as SaveAs (Office 2000 Word 2000)

    Hi Bj

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Save to act as SaveAs (Office 2000 Word 2000)

    Thanks a lot.
    It works!!

    I must have mist out some letters in the code.

    An other Q:

    What code to put in if I want to intercept the Cancel command on the Save As dialog box?

    Thanks in advance

    Regards
    Bj

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Save to act as SaveAs (Office 2000 Word 2000)

    Try something like this:

    With Dialogs(wdDialogFileSaveAs)
    Select Case .Display
    Case 0 ' Cancel
    ' No need to do anything on Cancel
    ' Unless you want to display a message
    Case -1 ' OK
    ' Whatever you want to do on OK, for instance
    .Execute
    End Select
    End With

    The Display method of a dialog will show the dialog without applying the settings. The result of Display is -1 if the user clicks OK, 0 if the user clicks Cancel. If the result is -1, the Execute method applies the settings.

  5. #5
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Save to act as SaveAs (Office 2000 Word 2000)

    Things are simple as long as one know, else it is difficult. It is very difficult to search for that type of help in VBA Help.

    Anyway thanks a lot. I will try this out asap.

    Regards
    Bj

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Save to act as SaveAs (Office 2000 Word 2000)

    Yes, it can be VERY difficult to find out the little things, particularly regarding the built-in dialogs. To test return values, you can use one of the following procedures, since .Display doesn't actually execute the action (with a few exceptions that have occasioned discussions on this or the VB board):

    Sub DispDontExecMsg()
    MsgBox "Return value = " & Dialogs(wdDialogFileSaveAs).Display
    End Sub

    Sub DispDontExecPrint()
    Debug.Print "Return value = " & Dialogs(wdDialogFileSaveAs).Display
    ' String appears in the Immediate window
    End Sub

  7. #7
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Save to act as SaveAs (Office 2000 Word 2000)

    Thanks to all of you, I verry much appreciat your help!

    I will try out the code asap.

    To my experience this is the best place to get and give help and information!

    Best regards
    Bj

Posting Permissions

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