Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Placing name in SAVE as field (Word 2000/SR1)

    Using VBA how do I make the default name of a word doc being what I what to show in the file name field in the SaveAs dialog

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

    Re: Placing name in SAVE as field (Word 2000/SR1)

    I don't quite understand what you wrote, but check out <post#=263403>post 263403</post#>. If that doesn't help, post back.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Placing name in SAVE as field (Word 2000/SR1)

    Thanks. I pasted the Saveas macro into a new module but when I go to file|Saveas the macro is never called.

    Yes the idea is that I want to be able to place the name of the doc in the save as file name label rather than the first text characters in the doc being place into the file name field as is the default.

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

    Re: Placing name in SAVE as field (Word 2000/SR1)

    I don't understand.

    When you create a new document, Word can't put the name of the document in the file name box of the Save As dialog, for it doesn't have a name yet, so Word proposes the first word(s) in the document as name. If you open an existing document and select File | Save As..., the name of the document is put in the file name box of the Save As dialog.

    The FileSave and FileSaveAs macros should be placed in a module in Normal.dot or in a global template if you want them to be applied to all documents. And they should have exactly those names if you want them to override the built-in commands.

  5. #5
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Placing name in SAVE as field (Word 2000/SR1)

    I am confused as well, let me try to explain what I am doing. I have 32 word templates with VBA code in them, and I also have a Word addin with a function that each of the templates can call that will allow a user to select one of the 32 custom templates to open. It is desired that the name of the chosen template be the default name that appears in the name label in the saveas dialog.

  6. #6
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Placing name in SAVE as field (Word 2000/SR1)

    Oh here is the code I am surrently using the the Word addin to open a word doc based on one of the 32 templates.

    On Error Resume Next
    ' Try and establish link to existing open instance of word
    Set objWorkpaperWord = GetObject(, "Word.Application")

    ' If it fails then open a word instance
    If objWorkpaperWord Is Nothing Then
    Set objWorkpaperWord = CreateObject("Word.Application")
    End If
    objWorkpaperWord.ActiveWindow.Activate
    objWorkpaperWord.Visible = True
    objWorkpaperWord.Activate
    objWorkpaperWord.Documents.Add (gFileToOpen) ' gFileToOpen was passed int
    objWorkpaperWord.ActiveWindow.Caption = strDocname ' strDocname was passed in


    ' Clean up memory
    Set objWorkpaperWord = Nothing

    End Function

  7. #7
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Placing name in SAVE as field (Word 2000/SR1)

    Thanks. If I place that SaveAs sub in my Word Addin then I am able to control the name of the propsed file in the Saveas.

    The code section that I posted in the previous reply is from the Word addin. if after opening one of my templates from the addin code, I open another one, the newly opened template does not have focus. the same code used from an Excel workbook works fine. Any ideas?

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

    Re: Placing name in SAVE as field (Word 2000/SR1)

    Try something like this:

    Dim objWordDoc As Word.Document
    Set objWordDoc = objWorkpaperWord.Documents.Add(gFileToOpen) ' gFileToOpen was passed int
    objWordDoc.Activate

Posting Permissions

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