Document title

J

jan

Whenever i create a new document, I have a autonew macro open a inputbox so I can name the new document. Next I open the dialog with Summary information (wdDialogFileSummaryInfo) so I can enter a title for the document. As title I always use the extensionless document name. It seems a bit redundant to type the same thing twice -once as name for the document, once as title. I know how to extract the document's title to a variable (so I could turn the order of things around and type the title first, but I have reasons why I want to keep the order I've outlined), but I can't find a way to set the document's title to the value of a variable

Can anyone help me with this

Thank you, Ja
 
H

Helmut Weber

Hi Jan,
Dim d As Document
Dim s As String
s = "Test-Title............"
Set d = ActiveDocument
d.BuiltInDocumentProperties("Title") = s

Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr(64) & "t-online.de"
Word XP, Windows 2000
 
P

Peter Hewett

Hi jan

use the following code to set the document title:

ActiveDocument.BuiltInDocumentProperties _
(wdPropertyTitle).Value = "Your title"

HTH + Cheers - Peter
 
P

Peter Hewett

Hi Jan

The problem is the following 2 lines of code:

Application.Dialogs(wdDialogFileSummaryInfo).Update
Application.Dialogs(wdDialogFileSummaryInfo).Show

For some reason when you update or show the FileSummaryInfo dialog it wipes the
changes to the document property.

It works fine once you remove those two lines.

HTH + Cheers - Peter
 
J

Jan

Thank you Peter, you were right. Leaving out those two lines does the trick. Which I think is strange, so I started experimenting a bit and guess what: when i save the document under it's new name first and only thén open the File Summary Dialog, the title is displayed correctly. Though why in that case I am asked if I want to save the template as well... I don't know, but I solved that by setting the saved-property of the template to True. Now things goo as they should
:
Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top