I have the form fields named text1, text2, etc. I want to save the file as
text1 text2 (today's date) unit text7.doc
"Jay Freedman" wrote:
On Mon, 20 Feb 2006 08:05:27 -0800, AMG
wrote:
I want to save documents using data that I have entered in form fields as the
title.
You'll need a macro to do that. Because you've given almost no details
about your documents, it's hard to recommend what should be in the
macro. At a minimum you'll need a statement like this:
ActiveDocument.SaveAs FileName:= _
ActiveDocument.FormFields("CaseName").Result & ".doc"
but replace "CaseName" with the actual name of the form field
containing the text that forms the first part of the file name.
There are a lot of other things to think about. For instance:
- If you want the file to be saved in a folder other than the one
listed as the Documents folder in Tools Options File Locations,
you'll have to put that path into the FileName expression.
- You'll have to check the field result to make sure it isn't empty
and doesn't contain any characters that aren't legal in a file name.
- You'll need error handling in case the folder isn't available or
something else unexpected happens.
- If your macro is named FileSaveAs, it will run instead of the
built-in SaveAs command (see
http://www.word.mvps.org/FAQs/Macros...tSavePrint.htm). That
may or may not be what you want to do.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.