SOLVED

Can Word automatically suggest/prompt document property 'Title' when saving the document?

Copper Contributor

In Word 365, I have created a Letter template with an AutoNew macro and a userform that prompts the user to fill in various details of the letter (title/heading, recipient, case no., etc.) and this info is then put into the right places in the document AND some of that info is also stored in the document properties (general as well as custom). So far so good, all works perfectly.

 

On save, the suggested file name is as usual the first few words of the document, in this case the recipient of the letter. But since we already have registered the title in the document properties, it would be so neat if Word could suggest that instead – is that possible? With or without VBA code?

 

Suggestions are very much appreciated

9 Replies

@ChristineB You should be able to make use of part of the code that creates the Document Property and with additional code, display the File SaveAs dialog, prepopulated with that information, or just have a command that simply saves the document with it.

Thanks Doug, I will give that some thought.
I do however not wish to display the FileSaveAs dialog as part of the AutoNew macro, I want the SaveAs dialog to be prepopulated with the document property Title as file name when the user decides to save the document the first time.
Maybe I'll have to have a look at EventHandling and OnSave...
best response confirmed by ChristineB (Copper Contributor)
Solution

 

@ChristineB 

See the article "How to set the default suggested filename to be displayed by the Save As dialog the first time a user saves a new document” at:

wordmvp.com/FAQs/MacrosVBA/SetDefFilename.htm

@Doug_Robbins_Word_MVP
It works!! Thank you so much for pointing me in the right direction!
Only little hitch is that it only works when using Ctrl+s or clicking in the Save icon, not when using the Word dropdown menu File, Save…, then there is no file name suggested at all – do you know why?
Can that saving method be pre-populated with the title too? Or is that out of reach for Word/VBA?

@ChristineB In my experimentation, it works when using File>Save, but not if you use File>Save As.

@Doug_Robbins_Word_MVP 

 

This is what I get when using menu File, Save to save (the grey text 'Angiv filnavnet her' means 'Write file name here')

FileSaveFileSave

And when I use Ctrl+s; the document title is correctly suggested as file name (sorry about the Danish user interface):

Ctrl+sCtrl+s

Maybe something in my Word settings??

@Doug_Robbins_Word_MVPc
I will test the solution on a few other PCs with slightly different Word installations and see if that makes a difference...
Hi @ChristineB,
Did you ever find a solution that works in the File > SaveAs method? I'm having the exact issue you describe here.

Thank you!
Quick question: Are you saving to the Built-In Document Property or to a Custom Document Property named "Title." If the Former, if use Insert>Quick Part>Document Property>Title, it will give your document property content; if custom, it will not.
1 best response

Accepted Solutions
best response confirmed by ChristineB (Copper Contributor)
Solution

 

@ChristineB 

See the article "How to set the default suggested filename to be displayed by the Save As dialog the first time a user saves a new document” at:

wordmvp.com/FAQs/MacrosVBA/SetDefFilename.htm

View solution in original post