Reputation: 11213
I have an old Word macro that is supposed to get the document Title by calling
DocTitle = ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)
or
Set oBuiltInProps = ActiveDocument.BuiltInDocumentProperties
strValue = oBuiltInProps.Item("Title").Value
On a new document this is done after a call to SaveAs (I also tried SaveAs2) which used to make sure that the first sentence of the document populated the Documenttitle property. However this no longer seems to be working and I'm just getting a blank string.
This is on my Dev machine so its possible there is a setting in word I don't have set, but I don't remember one.
Does anyone know how I can force saving of a document to create the DocumentTitle?
I am using Word 2010
(I have a seperate working installation using Word 2010 but was origionally written for and word 97)
Upvotes: 0
Views: 1786
Reputation: 17039
If I understand correctly and you're looking for a way to simply get the document title in Word 2010, you can use the following macro:
Dim Title As String
Title = ActiveDocument.Name
MsgBox (Title)
Upvotes: 2