How to assign filename automatically from document content?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have another problem with Word. I tried to make a document with a subject
line where the end user will type in the text in it.
I then want to take this subject string as the filename. So when the user
save the file, it would automatically assign the string as the name. Could
this be done easily with {MacroButton}?
 
There are two ways Word comes up with an automatic filename:

1. From the Title field in the File Properties.

2. From the first few words in the document (up to the first punctuation
mark) if the Title field is blank.

If you enable "Prompt for document properties" on the Save tab of Tools |
Options, the Properties dialog will be presented when you save, and you can
fill in the Title field; unfortunately, this happens only *after* you have
selected a filename, so it's no help.

So the only approach that will work is to write text to the Title field
before saving the document. You could write a macro to collect the filename
and write it to the Title property, but instead of using a MacroButton
(which would require that the user double-click it), I would suggest a
UserForm loaded by an AutoNew macro. The UserForm need have only one field;
the data entered in that field will become the Title field. If you need help
with the required VBA, please post in one of the word.vba NGs.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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

Back
Top