how do I generate filename from text in Word document

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

Guest

I want to automatically generate the filename to save as from data at the top
of a document.
 
Is the "data at the top of a document" in a form field, a bookmark, a
table cell, or something else that's clearly identifiable? Or is it
just some plain text?

Once you know where to look, you can create macros in the template on
which these documents are based. Catching all the possible ways for an
unsaved document to be saved (and thus named) is a bit difficult. See
http://www.word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm.

In each macro, you get the data from the document, modify it if
necessary, and put it into the document's Title property -- see
http://www.word.mvps.org/FAQs/MacrosVBA/SetDefFilename.htm. Finally,
you call

Dialogs(wdDialogFileSaveAs).Show

to display the SaveAs dialog, which will have your automatically
generated file name in the File Name box.

--
Regards,
Jay Freedman
Microsoft Word MVP
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