Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default title for new document (Word 2000 SR-1)

    Normally, on a new document, Word uses the first few words as a default title when saving the document for the first time. Is there any way to get Word to use words from a field on the document instead?
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  2. #2
    Star Lounger
    Join Date
    Jun 2002
    Posts
    98
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Default title for new document (Word 2000 SR-1)

    <pre>Sub ChangeDocTitle()
    'Get the title from fields, prompts, date, etc...whatever!
    newTitle = ActiveDocument.FormFields("AnyFormField").Result
    With Dialogs(wdDialogFileSummaryInfo)
    .Title = newTitle
    .Execute
    End With
    End Sub</pre>


    Don't bother trying to set the Title property directly in VB. If you don't go through the dialog box it doesn't always work. V. frustrating.
    __________________________________________________ ____
    <img src=/S/nun.gif border=0 alt=nun width=20 height=20> Sister Dory
    Our Lady of Perpetual Help, Holstein Falls, Wisconsin, USA

  3. #3
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Default title for new document (Word 2000 SR-1)

    Thanks for the response; unfortunately, I asked the wrong question (my apologies). <img src=/S/doh.gif border=0 alt=doh width=15 height=15> Let's try this again...

    What I really wanted to do was to take the text from the form field and use it for the default file name when saving the document; i.e., Form Field Text.doc. Can this be done in a similar manner?
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  4. #4
    2 Star Lounger
    Join Date
    May 2002
    Location
    Midland, Michigan, USA
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default title for new document (Word 2000 SR-1)

    Going with what you already have, is this what you're looking for?

    <pre>Sub TestSave()
    Dim FileName As String
    <font color=448800>'This pulls the name from your 'AnyFormField' field</font color=448800>
    FileName = ActiveDocument.FormFields("AnyFormField").Result
    <font color=448800>'Show the SaveAs dialog box</font color=448800>
    With Dialogs(wdDialogFileSaveAs)
    <font color=448800>'with your suggested filename</font color=448800>
    .Name = FileName & ".doc"
    .Show
    End With
    End Sub
    </pre>


  5. #5
    Star Lounger
    Join Date
    Jun 2002
    Posts
    98
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Default title for new document (Word 2000 SR-1)

    Oh, yes! Actually that's what I was doing there. See, if you have text entered in the Document's Title properties (File...Properties...Title) then when the user saves the file the FIRST time it will use that text instead of the first few words of the document.

    I like to do that so the user can save whenever they want. But the macro to replace the save command works too. :-)
    __________________________________________________ ____
    <img src=/S/nun.gif border=0 alt=nun width=20 height=20> Sister Dory
    Our Lady of Perpetual Help, Holstein Falls, Wisconsin, USA

  6. #6
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default title for new document (Word 2000 SR-1)

    What's crazy is that the suggested name corresponds to the Title property if I enter it manually, but not if I set it in a macro:
    ActiveDocument.BuiltInDocumentProperties(wdPropert yTitle) = "New title"

    Am I missing something? Or is this a bug?

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>Klaus

  7. #7
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Default title for new document (Word 2000 SR-1)

    Worked like a charm! Thanks to all.
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  8. #8
    Star Lounger
    Join Date
    Jun 2002
    Posts
    98
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Default title for new document (Word 2000 SR-1)

    Yup. It's a bug (I think!) AND you're missing something.

    "Don't bother trying to set the Title property directly in VB. If you don't go through the dialog box it doesn't always work. V. frustrating." You can use VB to enter the text in the dialog box using the code I posted above.
    __________________________________________________ ____
    <img src=/S/nun.gif border=0 alt=nun width=20 height=20> Sister Dory
    Our Lady of Perpetual Help, Holstein Falls, Wisconsin, USA

  9. #9
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default title for new document (Word 2000 SR-1)

    Oh, I must have missed that part <img src=/S/wink.gif border=0 alt=wink width=15 height=15>

    Sorry, Klaus

Posting Permissions

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