First Para...

D

David J

I am writing a template for MS Word 2000. I would like
to be able to pick up the first paragraph of the document
at the time of closing or saving the document, and insert
it as the filename into the Word "Save As..." dialog
box. Ideally I would like to append the current date to
it to make the "Save As..." filename.

I can't see a way of doing this, can anyone help ?

Appreciate any advice

Dave
 
C

Cindy Meister -WordMVP-

Hi David,

In my experience, Word does this for you automatically - if
the template doesn't contain any text...

Basically, you'd need a macro named FileSaveAs so that it
fires when the user calls the command. Something like this
could work:

Sub FileSaveAs()
Dim szFileName
szFileName = ActiveDocument.Paragraphs(1).Range.Text
With Dialogs(wdDialogFileSaveAs)
.Name = Left( _
szFileName, _
Len(szFileName) - 1)
.Show
End With
End Sub
I am writing a template for MS Word 2000. I would like
to be able to pick up the first paragraph of the document
at the time of closing or saving the document, and insert
it as the filename into the Word "Save As..." dialog
box. Ideally I would like to append the current date to
it to make the "Save As..." filename.

I can't see a way of doing this, can anyone help ?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
S

Suzanne S. Barnhill

Provided the Title field of the document template is blank (File |
Properties), Word will suggest the first few words of the document (up to
the first punctuation mark) as a filename. Beyond that, you would need a
macro to write your desired filename to the Title property.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
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

Top