Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to change document properties (Title, Keywods, etc) with VBA.

1,996 views
Skip to first unread message

Pedro Bastos Correia

unread,
Feb 18, 1999, 3:00:00 AM2/18/99
to
Somebody have idea about how to change document properties in word 97 using
VBA.

Thanks.


Doug Robbins

unread,
Feb 18, 1999, 3:00:00 AM2/18/99
to
Hi Pedro,

ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = "test"

changes the Title of the active document to test.

For a list of the properties, check out the DocumentPropertyObject in the
VBA on-line help. You refer to each of the properties listed there by
prefacing it with wdProperty as indicated in the above example.

Hope this helps.
Regards,
Doug Robbins - Word MVP

To assist in maintaining the thread for the benefit of others, please post
any response to the NewsGroup.
Pedro Bastos Correia <pedr...@euronut.com> wrote in message
news:7agpcj$k...@news3.euro.net...

Jonathan West

unread,
Feb 18, 1999, 3:00:00 AM2/18/99
to
Hi Pedro,

ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = MyNewTitle$

This should do it. Do a search in Word VBA help on "wdProperty" to get the
constants to use for other properties.

Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email


Pedro Bastos Correia wrote in message <7agpcj$k...@news3.euro.net>...

marcel van zoggel

unread,
Mar 3, 1999, 3:00:00 AM3/3/99
to
>ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = "test"

When doing this for an new (not yet saved) document, i would expect
that this new title becomes the default filename.
Manually setting this title in the file-properties-dialog does change
the default filename.

How can i do this through code ???


Will Rickards

unread,
Mar 3, 1999, 3:00:00 AM3/3/99
to
Look into the built-in Dialogs.

With Dialogs(wdDialogFileSummaryInfo)
.Title = "hello"
.Execute
End With


--
Will Rickards
Software Engineer
wric...@op.net
http://www.op.net/~wrickard

Please post ALL replies/requests to the newsgroup for the benefit of the newsgroup.

marcel van zoggel wrote in message <36dce2e9....@msnews.microsoft.com>...

François DUCLOS

unread,
Mar 5, 1999, 3:00:00 AM3/5/99
to
Try this:

Sub title_of_my_file()

ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = "test_my_name"

' COMMENT: if you do not set the path, the file is saved to the default path

my_path = "c:\"

my_name = ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle).Value &
".doc"

ActiveDocument.SaveAs (my_path & my_name)

End Sub


If it is OK for what you need, adapt it to your macros !

Enjoy yourself

Bye

0 new messages