Results 1 to 7 of 7
  1. #1
    jim@coam.net
    Guest

    using macro to set document title? (word 97-sr3)

    I am trying to use the results from a user input box as the document title (ie, file, properties, title).
    I have the input box in the template, and it comes up fine, but i cannot find how to write those input results to the title.... is it possible?

  2. #2
    BAM
    Guest

    Re: using macro to set document title? (word 97-sr3)

    Hi Jim,

    Take a look at this post for method you can use.
    ~~~~~~~~~~~~~
    Cheers!

  3. #3
    jim@coam.net
    Guest

    Re: using macro to set document title? (word 97-sr3)

    that did work great, but now i've found that i need to unlink the fields after the document is finished (due to some strange things the fields do when i translate the finished document later...)...so, i tried an AutoClose macro that was: "ActiveDocument.Fields.Unlink" ..but when i save that in my template, it wipes the FILLIN fields in the template! is there a way to create/save the autoclose macro without wiping out the fillin fields in the template...just unlinking them in documents created from the template? seems like a catch-22?
    Thanks!

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

    Re: using macro to set document title? (word 97-sr3)

    You can use a test like the following in the Autoclose macro:

    If LCase(Right(ActiveDocument.FullName, 4)) <> ".dot" Then
    'it's not the template, OK to unlink fields
    End If

    Gary

  5. #5
    BAM
    Guest

    Re: using macro to set document title? (word 97-sr3)

    How about:

    If ActiveDocument.Type <> wdTypeTemplate Then
    'Insert Code Here
    End If

    instead? <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

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

    Re: using macro to set document title? (word 97-sr3)

    Nice, thanks!

    The one I posted is an old chestnut that was handed down to me.
    But your version is much simpler and simpler is better - I'll give this a try in a live environment tomorrow, but it should work fine.

    Gary

  7. #7
    Lounger
    Join Date
    Jan 2001
    Location
    Milton Keynes, Buckinghamshire, England
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: using macro to set document title? (word 97-sr3)

    Jim,

    I know you have solved your problem in a different way, but the code you were originally asking for to write the results of an input box as the document title would be a line of VBA that read something like:

    ActiveDocument.BuiltInDocumentProperties("Title"). Value =[DocumentTitle]

    where [DocumentTitle] represents the results of your input box.

    Would something like this have met your needs?

Posting Permissions

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