A Macro to Save Files

G

Guest

I have an attorney who wants a specific naming convention for his files:

2006.11.20_[Atty Initials]_[Name of Document]_[Recipient].doc

The attorney initials would not exceed 3 spaces. Since there are several
associates/legal staff who are going to be required to implement this method
for this particular attorney, I thought a macro would be the easiest way of
getting the job done and ensure consistency for everyone involved.

Since I have yet to write a macro in Word, I thought this forum would be a
very good place to start gathering information for this project. Thank you
in advance for any help you can provide me.
 
D

Doug Robbins - Word MVP

The save part is easy - ActiveDocument.SaveAs "Path\Filename"

Getting the name for the file is where the work is and I would suggest that
you should have a userform in the template from which the documents are
created that has controls on it into which the user enters that information.
Almost certainly, the recipient and the name of the document are required in
the document somewhere and once the data is entered into the userform, the
code in the form could enter it into the document as well as save the
document with the required name.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Guest

If I understand what you are saying, your userform approach isn't going to
work. There isn't one specific template involved: there are court pleadings,
fax cover sheets, letterhead, and agreements which are prepared from the
normal.dot template. Creating a specific template for each type of document,
for this one particular attorney, would not be a solution, from what I can
tell.

So - you're basically saying that a macro to perform this function is out of
the question?

Doug Robbins - Word MVP said:
The save part is easy - ActiveDocument.SaveAs "Path\Filename"

Getting the name for the file is where the work is and I would suggest that
you should have a userform in the template from which the documents are
created that has controls on it into which the user enters that information.
Almost certainly, the recipient and the name of the document are required in
the document somewhere and once the data is entered into the userform, the
code in the form could enter it into the document as well as save the
document with the required name.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

JeanneJo said:
I have an attorney who wants a specific naming convention for his files:

2006.11.20_[Atty Initials]_[Name of Document]_[Recipient].doc

The attorney initials would not exceed 3 spaces. Since there are several
associates/legal staff who are going to be required to implement this
method
for this particular attorney, I thought a macro would be the easiest way
of
getting the job done and ensure consistency for everyone involved.

Since I have yet to write a macro in Word, I thought this forum would be a
very good place to start gathering information for this project. Thank
you
in advance for any help you can provide me.
 
D

Doug Robbins - Word MVP

And just how do you prepare each of those documents from the normal.dot
template? Starting with a blank page each time? Surely not.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

JeanneJo said:
If I understand what you are saying, your userform approach isn't going to
work. There isn't one specific template involved: there are court
pleadings,
fax cover sheets, letterhead, and agreements which are prepared from the
normal.dot template. Creating a specific template for each type of
document,
for this one particular attorney, would not be a solution, from what I can
tell.

So - you're basically saying that a macro to perform this function is out
of
the question?

Doug Robbins - Word MVP said:
The save part is easy - ActiveDocument.SaveAs "Path\Filename"

Getting the name for the file is where the work is and I would suggest
that
you should have a userform in the template from which the documents are
created that has controls on it into which the user enters that
information.
Almost certainly, the recipient and the name of the document are required
in
the document somewhere and once the data is entered into the userform,
the
code in the form could enter it into the document as well as save the
document with the required name.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

JeanneJo said:
I have an attorney who wants a specific naming convention for his files:

2006.11.20_[Atty Initials]_[Name of Document]_[Recipient].doc

The attorney initials would not exceed 3 spaces. Since there are
several
associates/legal staff who are going to be required to implement this
method
for this particular attorney, I thought a macro would be the easiest
way
of
getting the job done and ensure consistency for everyone involved.

Since I have yet to write a macro in Word, I thought this forum would
be a
very good place to start gathering information for this project. Thank
you
in advance for any help you can provide me.
 
G

Guest

I have a template for letterhead, a template for the fax cover sheets, two
templates for court paper and the normal.dot is just for the "other" stuff.
The problem is that these templates are used by everyone in the office, but
the new naming format is specific to one attorney for just his cases, and for
the associates and paralegals who work on those cases with him. There are
other cases, other attorneys, that have nothing whatsoever to do with what
this one guy is doing. That's why I say I don't particularly want to have to
create 4 separate templates specific to this one particular attorney to rule
the way everyone else in the office names and saves their documents. Of
course I will if that's what needs doing, but a macro just seems so much
simpler (or maybe not).

That's why I was thinking about using a system macro instead of
template-specific macros.

Doug Robbins - Word MVP said:
And just how do you prepare each of those documents from the normal.dot
template? Starting with a blank page each time? Surely not.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

JeanneJo said:
If I understand what you are saying, your userform approach isn't going to
work. There isn't one specific template involved: there are court
pleadings,
fax cover sheets, letterhead, and agreements which are prepared from the
normal.dot template. Creating a specific template for each type of
document,
for this one particular attorney, would not be a solution, from what I can
tell.

So - you're basically saying that a macro to perform this function is out
of
the question?

Doug Robbins - Word MVP said:
The save part is easy - ActiveDocument.SaveAs "Path\Filename"

Getting the name for the file is where the work is and I would suggest
that
you should have a userform in the template from which the documents are
created that has controls on it into which the user enters that
information.
Almost certainly, the recipient and the name of the document are required
in
the document somewhere and once the data is entered into the userform,
the
code in the form could enter it into the document as well as save the
document with the required name.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

I have an attorney who wants a specific naming convention for his files:

2006.11.20_[Atty Initials]_[Name of Document]_[Recipient].doc

The attorney initials would not exceed 3 spaces. Since there are
several
associates/legal staff who are going to be required to implement this
method
for this particular attorney, I thought a macro would be the easiest
way
of
getting the job done and ensure consistency for everyone involved.

Since I have yet to write a macro in Word, I thought this forum would
be a
very good place to start gathering information for this project. Thank
you
in advance for any help you can provide me.
 
G

Graham Mayor

Your problem is likely to be that the information you want to use for the
document naming convention is unlikely to be stored in the document in an
extractable form. Only if the data you want to include is ready placed in a
bookmark or docproperty field can it be simply extracted to make up a
filename. The date isn't a problem, but you have variable attorney names,
variable document names and variable recipient names. A userform is simply a
means of gathering that data and assigning it to the document and to a
filename. Whether you have a common macro to do this or separate similar
macros (or a combination of both) will rather depend on your documents and
where the relevant information is inserted in them. Clearly all of your
templates are going to have to be modified to automate this process.

When you have worked out how you want to do this, you could ask in the vba
group for help in achieving it.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


I have a template for letterhead, a template for the fax cover
sheets, two templates for court paper and the normal.dot is just for
the "other" stuff. The problem is that these templates are used by
everyone in the office, but the new naming format is specific to one
attorney for just his cases, and for the associates and paralegals
who work on those cases with him. There are other cases, other
attorneys, that have nothing whatsoever to do with what this one guy
is doing. That's why I say I don't particularly want to have to
create 4 separate templates specific to this one particular attorney
to rule the way everyone else in the office names and saves their
documents. Of course I will if that's what needs doing, but a macro
just seems so much simpler (or maybe not).

That's why I was thinking about using a system macro instead of
template-specific macros.

Doug Robbins - Word MVP said:
And just how do you prepare each of those documents from the
normal.dot template? Starting with a blank page each time? Surely
not.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

JeanneJo said:
If I understand what you are saying, your userform approach isn't
going to work. There isn't one specific template involved: there
are court pleadings,
fax cover sheets, letterhead, and agreements which are prepared
from the normal.dot template. Creating a specific template for
each type of document,
for this one particular attorney, would not be a solution, from
what I can tell.

So - you're basically saying that a macro to perform this function
is out of
the question?

:

The save part is easy - ActiveDocument.SaveAs "Path\Filename"

Getting the name for the file is where the work is and I would
suggest that
you should have a userform in the template from which the
documents are created that has controls on it into which the user
enters that information.
Almost certainly, the recipient and the name of the document are
required in
the document somewhere and once the data is entered into the
userform, the
code in the form could enter it into the document as well as save
the document with the required name.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of
my services on a paid consulting basis.

Doug Robbins - Word MVP

I have an attorney who wants a specific naming convention for his
files:

2006.11.20_[Atty Initials]_[Name of Document]_[Recipient].doc

The attorney initials would not exceed 3 spaces. Since there are
several
associates/legal staff who are going to be required to implement
this method
for this particular attorney, I thought a macro would be the
easiest way
of
getting the job done and ensure consistency for everyone involved.

Since I have yet to write a macro in Word, I thought this forum
would be a
very good place to start gathering information for this project.
Thank you
in advance for any help you can provide me.
 
G

Guest

I really am not interested in trying to pick up information contained within
the documents themselves to create the name. I would like the current date
to be automatic; attorney initials are no big deal - 2 to 3 characters; I
certainly don't want a full length insertion of a document name because
sometimes those names are pretty long, so I want the user to be able to put
in something simple, such as Purch_Agrmt, Lttr - that sort of thing - just
something simple to readily identify it to someone looking for a document.

I want something simple - other than the automatic date insertion, the
preparer can quickly fill in the other identifiers which, to me, would be
most easily done using a macro.

I already know what I want - and I will most certainly take it to the vba
site. After I posted my question, I started looking through the other sites
and realized I had probably erred in selecting the group I did.

I very much appreciate the suggestions from Graham and Doug - thank you.

Graham Mayor said:
Your problem is likely to be that the information you want to use for the
document naming convention is unlikely to be stored in the document in an
extractable form. Only if the data you want to include is ready placed in a
bookmark or docproperty field can it be simply extracted to make up a
filename. The date isn't a problem, but you have variable attorney names,
variable document names and variable recipient names. A userform is simply a
means of gathering that data and assigning it to the document and to a
filename. Whether you have a common macro to do this or separate similar
macros (or a combination of both) will rather depend on your documents and
where the relevant information is inserted in them. Clearly all of your
templates are going to have to be modified to automate this process.

When you have worked out how you want to do this, you could ask in the vba
group for help in achieving it.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


I have a template for letterhead, a template for the fax cover
sheets, two templates for court paper and the normal.dot is just for
the "other" stuff. The problem is that these templates are used by
everyone in the office, but the new naming format is specific to one
attorney for just his cases, and for the associates and paralegals
who work on those cases with him. There are other cases, other
attorneys, that have nothing whatsoever to do with what this one guy
is doing. That's why I say I don't particularly want to have to
create 4 separate templates specific to this one particular attorney
to rule the way everyone else in the office names and saves their
documents. Of course I will if that's what needs doing, but a macro
just seems so much simpler (or maybe not).

That's why I was thinking about using a system macro instead of
template-specific macros.

Doug Robbins - Word MVP said:
And just how do you prepare each of those documents from the
normal.dot template? Starting with a blank page each time? Surely
not.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

If I understand what you are saying, your userform approach isn't
going to work. There isn't one specific template involved: there
are court pleadings,
fax cover sheets, letterhead, and agreements which are prepared
from the normal.dot template. Creating a specific template for
each type of document,
for this one particular attorney, would not be a solution, from
what I can tell.

So - you're basically saying that a macro to perform this function
is out of
the question?

:

The save part is easy - ActiveDocument.SaveAs "Path\Filename"

Getting the name for the file is where the work is and I would
suggest that
you should have a userform in the template from which the
documents are created that has controls on it into which the user
enters that information.
Almost certainly, the recipient and the name of the document are
required in
the document somewhere and once the data is entered into the
userform, the
code in the form could enter it into the document as well as save
the document with the required name.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of
my services on a paid consulting basis.

Doug Robbins - Word MVP

I have an attorney who wants a specific naming convention for his
files:

2006.11.20_[Atty Initials]_[Name of Document]_[Recipient].doc

The attorney initials would not exceed 3 spaces. Since there are
several
associates/legal staff who are going to be required to implement
this method
for this particular attorney, I thought a macro would be the
easiest way
of
getting the job done and ensure consistency for everyone involved.

Since I have yet to write a macro in Word, I thought this forum
would be a
very good place to start gathering information for this project.
Thank you
in advance for any help you can provide me.
 
G

Guest

Hello I'm also looking for a way to automatically name word files in the
format "Year-Month-Date Subject" & I like your userform idea. Can you take me
through the SAVE part using the date & text from the userform please? Thanks.
Kate Lavender.

Doug Robbins - Word MVP said:
The save part is easy - ActiveDocument.SaveAs "Path\Filename"

Getting the name for the file is where the work is and I would suggest that
you should have a userform in the template from which the documents are
created that has controls on it into which the user enters that information.
Almost certainly, the recipient and the name of the document are required in
the document somewhere and once the data is entered into the userform, the
code in the form could enter it into the document as well as save the
document with the required name.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

JeanneJo said:
I have an attorney who wants a specific naming convention for his files:

2006.11.20_[Atty Initials]_[Name of Document]_[Recipient].doc

The attorney initials would not exceed 3 spaces. Since there are several
associates/legal staff who are going to be required to implement this
method
for this particular attorney, I thought a macro would be the easiest way
of
getting the job done and ensure consistency for everyone involved.

Since I have yet to write a macro in Word, I thought this forum would be a
very good place to start gathering information for this project. Thank
you
in advance for any help you can provide me.
 
G

Graham Mayor

Sub NameDoc()
Dim strFilename As String
strFilename = InputBox("Subject?", "File Name & Save")
strFilename = Format(Date, "yyyy-MM-dd-") & strFilename & ".doc"
ActiveDocument.SaveAs strFilename
ActiveWindow.Caption = ActiveDocument.FullName
End Sub

will do it, but if you want 'automatic' you will need to work out where the
'subject' part comes from.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Kate said:
Hello I'm also looking for a way to automatically name word files in
the format "Year-Month-Date Subject" & I like your userform idea. Can
you take me through the SAVE part using the date & text from the
userform please? Thanks. Kate Lavender.

Doug Robbins - Word MVP said:
The save part is easy - ActiveDocument.SaveAs "Path\Filename"

Getting the name for the file is where the work is and I would
suggest that you should have a userform in the template from which
the documents are created that has controls on it into which the
user enters that information. Almost certainly, the recipient and
the name of the document are required in the document somewhere and
once the data is entered into the userform, the code in the form
could enter it into the document as well as save the document with
the required name.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

JeanneJo said:
I have an attorney who wants a specific naming convention for his
files:

2006.11.20_[Atty Initials]_[Name of Document]_[Recipient].doc

The attorney initials would not exceed 3 spaces. Since there are
several associates/legal staff who are going to be required to
implement this method
for this particular attorney, I thought a macro would be the
easiest way of
getting the job done and ensure consistency for everyone involved.

Since I have yet to write a macro in Word, I thought this forum
would be a very good place to start gathering information for this
project. Thank you
in advance for any help you can provide me.
 

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