BobW
Tue May 13 16:17:00 PDT 2008
Correction: putting the following subroutine in a template causes the file
save dialog to appear whenever one creates a new .doc from a template:
Sub AutoNew()
Dialogs(wdDialogFileSaveAs).Show
End Sub
..then in the template, if you insert your desired filename convention
prompt in Document Properties - File Name, such as 'yymmdd check number item
description' and save the template, when you use the template to start a .doc
it will automatically force the user to save the new .doc immediately and
your prompt will appear in the file name field to (hopefully) remind people
of your naming convention.
That's one very quick and dirty way to do it. One caveat I observed: your
prompt can't contain anything but letters and numbers.
Jay, your solution sounds far more professional and desirable, but, alas,
complicated beyond my capabilities, at least for now. But many thanks - those
MVP links got me this far, and hopefully not into too much trouble ...
"Bob W" wrote:
> Simply running Sub AutoNew() causes the file save as dialog to appear.
> The suggested file name (suggested by Word) is always the Title in Document
> Properties (which Word somehow automatically extracts from the first sentence
> in the document). I'd settle for a simple way to insert a desired file
> naming convention prompt in the DocProperties Title box in place of the text
> that Word automatically places there. I'm not seeing how to do that,
> however....learning Word Basic on the fly is agonizingly slow sometimes.
>
> I am not too concerned about people accidentally generating files named,
> "please type the date (yymmdd), check number, and brief description of
> item.doc"...I almost like it that way: it provides immediate albeit slightly
> annoying reinforcement of the naming convention.
>
>
> "Jay Freedman" wrote:
>
> > Bob W wrote:
> > > For a specific template only, can a macro trigger a file/save as AND
> > > place a suggested file naming convention prompt in the Filename
> > > window of the File 'Save As' dialog?
> > >
> > > ie,
> > > User clicks a macrobutton;
> > > Word's Save As dialog opens;
> > > In the File Name window, a suggested file name schema appears, ie.,
> > > "please type the date (yymmdd), check number, and brief description
> > > of item"
> >
> > I wouldn't advise doing it that way. Guaranteed, at some point you'll hit
> > Enter unintentionally and get a file named "please type the date (yymmdd),
> > check number, and brief description of item.doc".
> >
> > A better idea is to intercept the Save As command
> > (
http://www.word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm), display an
> > inputbox or userform to get the necessary information (or, preferably,
> > construct the filename from information already in the document), and place
> > the suggested filename into the Title document property
> > (
http://www.word.mvps.org/FAQs/MacrosVBA/SetDefFilename.htm). Then call
> > Dialogs(wdDialogFileSaveAs).Show
> > (
http://www.word.mvps.org/FAQs/MacrosVBA/WordDlgHelp.htm).
> >
> > If the FileSaveAs macro is stored in the same template used as a base for
> > this type of document, then it will operate only in those documents.
> >
> > --
> > 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.
> >
> >
> >