PC Review


Reply
Thread Tools Rate Thread

Automatic Path with Date

 
 
codeweb@gmail.com
Guest
Posts: n/a
 
      26th Feb 2010
I have some questions hopefully someone can assist.

I want to save my word documents by default in the d:\path location
with the following format

"2010-02-26 File Name.doc "– I would like to insert the date
automatically.

Appreciate your assistance.
 
Reply With Quote
 
 
 
 
Doug Robbins - Word MVP
Guest
Posts: n/a
 
      26th Feb 2010
Use a macro containing the following commands:

With Dialogs(wdDialogFileSaveAs)
If .Display Then
With ActiveDocument
.SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
End With
End If
End With

If you create the macro with the name of Sub FileSaveAs() in your normal.dot
template or in an add-in, it will run whenever the File>SaveAs command is
used.

--
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, originally posted via msnews.microsoft.com

<(E-Mail Removed)> wrote in message
news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
> I have some questions hopefully someone can assist.
>
> I want to save my word documents by default in the d:\path location
> with the following format
>
> "2010-02-26 File Name.doc "– I would like to insert the date
> automatically.
>
> Appreciate your assistance.


 
Reply With Quote
 
janey
Guest
Posts: n/a
 
      27th Feb 2010
I was very interested in this reply as I save documents in this way so it
will save me having to put the date in each time I create a document.

However, is there a way of NOT running this macro - e.g. if I am creating a
template which does not need to have the date in the name?



"Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Use a macro containing the following commands:
>
> With Dialogs(wdDialogFileSaveAs)
> If .Display Then
> With ActiveDocument
> .SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
> End With
> End If
> End With
>
> If you create the macro with the name of Sub FileSaveAs() in your
> normal.dot template or in an add-in, it will run whenever the File>SaveAs
> command is used.
>
> --
> 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, originally posted via msnews.microsoft.com
>
> <(E-Mail Removed)> wrote in message
> news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
>> I have some questions hopefully someone can assist.
>>
>> I want to save my word documents by default in the d:\path location
>> with the following format
>>
>> "2010-02-26 File Name.doc "– I would like to insert the date
>> automatically.
>>
>> Appreciate your assistance.

>

 
Reply With Quote
 
janey
Guest
Posts: n/a
 
      27th Feb 2010
May I also ask what the macro would be to have:

"File Name 2010-02-26.docx"

"janey" <(E-Mail Removed)> wrote in message
news:8422EC26-6624-4404-8E3E-(E-Mail Removed)...
> I was very interested in this reply as I save documents in this way so it
> will save me having to put the date in each time I create a document.
>
> However, is there a way of NOT running this macro - e.g. if I am creating
> a template which does not need to have the date in the name?
>
>
>
> "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
>> Use a macro containing the following commands:
>>
>> With Dialogs(wdDialogFileSaveAs)
>> If .Display Then
>> With ActiveDocument
>> .SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
>> End With
>> End If
>> End With
>>
>> If you create the macro with the name of Sub FileSaveAs() in your
>> normal.dot template or in an add-in, it will run whenever the File>SaveAs
>> command is used.
>>
>> --
>> 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, originally posted via msnews.microsoft.com
>>
>> <(E-Mail Removed)> wrote in message
>> news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
>>> I have some questions hopefully someone can assist.
>>>
>>> I want to save my word documents by default in the d:\path location
>>> with the following format
>>>
>>> "2010-02-26 File Name.doc "– I would like to insert the date
>>> automatically.
>>>
>>> Appreciate your assistance.

>>

 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      27th Feb 2010
Instead of naming it FileSaveAs() call it something else and run it from a
toolbar button or suitable keyboard shortcut.
or
Insert the FileSaveAs macro only in the template that requires it - and not
the normal template.

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"janey" <(E-Mail Removed)> wrote in message
news:8422EC26-6624-4404-8E3E-(E-Mail Removed)...
>I was very interested in this reply as I save documents in this way so it
>will save me having to put the date in each time I create a document.
>
> However, is there a way of NOT running this macro - e.g. if I am creating
> a template which does not need to have the date in the name?
>
>
>
> "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
>> Use a macro containing the following commands:
>>
>> With Dialogs(wdDialogFileSaveAs)
>> If .Display Then
>> With ActiveDocument
>> .SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
>> End With
>> End If
>> End With
>>
>> If you create the macro with the name of Sub FileSaveAs() in your
>> normal.dot template or in an add-in, it will run whenever the File>SaveAs
>> command is used.
>>
>> --
>> 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, originally posted via msnews.microsoft.com
>>
>> <(E-Mail Removed)> wrote in message
>> news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
>>> I have some questions hopefully someone can assist.
>>>
>>> I want to save my word documents by default in the d:\path location
>>> with the following format
>>>
>>> "2010-02-26 File Name.doc "– I would like to insert the date
>>> automatically.
>>>
>>> Appreciate your assistance.

>>



 
Reply With Quote
 
Doug Robbins - Word MVP
Guest
Posts: n/a
 
      27th Feb 2010

Replace the line

.SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name

with

.SaveAs .Name & " " & Format(Date, "yyyy-mm-dd")

--
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, originally posted via msnews.microsoft.com

"janey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> May I also ask what the macro would be to have:
>
> "File Name 2010-02-26.docx"
>
> "janey" <(E-Mail Removed)> wrote in message
> news:8422EC26-6624-4404-8E3E-(E-Mail Removed)...
>> I was very interested in this reply as I save documents in this way so it
>> will save me having to put the date in each time I create a document.
>>
>> However, is there a way of NOT running this macro - e.g. if I am creating
>> a template which does not need to have the date in the name?
>>
>>
>>
>> "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
>> news:#(E-Mail Removed)...
>>> Use a macro containing the following commands:
>>>
>>> With Dialogs(wdDialogFileSaveAs)
>>> If .Display Then
>>> With ActiveDocument
>>> .SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
>>> End With
>>> End If
>>> End With
>>>
>>> If you create the macro with the name of Sub FileSaveAs() in your
>>> normal.dot template or in an add-in, it will run whenever the
>>> File>SaveAs command is used.
>>>
>>> --
>>> 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, originally posted via msnews.microsoft.com
>>>
>>> <(E-Mail Removed)> wrote in message
>>> news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
>>>> I have some questions hopefully someone can assist.
>>>>
>>>> I want to save my word documents by default in the d:\path location
>>>> with the following format
>>>>
>>>> "2010-02-26 File Name.doc "– I would like to insert the date
>>>> automatically.
>>>>
>>>> Appreciate your assistance.
>>>

 
Reply With Quote
 
janey
Guest
Posts: n/a
 
      28th Feb 2010
I think I must be missing something!

I want to use this macro in my office templates only.
I started with just one of them e.g. Office1.dot (which I brought over from
Word 2003 to 2007).
I created a macro called FileSaveAs:

Sub FileSaveAs()
'
' FileSaveAs Macro
' Saves a copy of the document in a separate file
'
With Dialogs(wdDialogFileSaveAs)
If .Display Then
With ActiveDocument
.saveas .Name & " " & Format(Date, "yyyy-mm-dd")
End With
End If
End With
End Sub

I then closed the template and opened a new document based on it. When I
pressed Save and put in a file name, e.g. Test, I got a file called
"Document1 2010-02-28.docx

How do I get this to be: Test 2010-02-28.docx please?

When I have this right, do I have to put the same macro in my other office
templates individually?


"Graham Mayor" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Instead of naming it FileSaveAs() call it something else and run it from a
> toolbar button or suitable keyboard shortcut.
> or
> Insert the FileSaveAs macro only in the template that requires it - and
> not the normal template.
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> "janey" <(E-Mail Removed)> wrote in message
> news:8422EC26-6624-4404-8E3E-(E-Mail Removed)...
>>I was very interested in this reply as I save documents in this way so it
>>will save me having to put the date in each time I create a document.
>>
>> However, is there a way of NOT running this macro - e.g. if I am creating
>> a template which does not need to have the date in the name?
>>
>>
>>
>> "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
>> news:#(E-Mail Removed)...
>>> Use a macro containing the following commands:
>>>
>>> With Dialogs(wdDialogFileSaveAs)
>>> If .Display Then
>>> With ActiveDocument
>>> .SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
>>> End With
>>> End If
>>> End With
>>>
>>> If you create the macro with the name of Sub FileSaveAs() in your
>>> normal.dot template or in an add-in, it will run whenever the
>>> File>SaveAs command is used.
>>>
>>> --
>>> 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, originally posted via msnews.microsoft.com
>>>
>>> <(E-Mail Removed)> wrote in message
>>> news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
>>>> I have some questions hopefully someone can assist.
>>>>
>>>> I want to save my word documents by default in the d:\path location
>>>> with the following format
>>>>
>>>> "2010-02-26 File Name.doc "- I would like to insert the date
>>>> automatically.
>>>>
>>>> Appreciate your assistance.
>>>

>
>

 
Reply With Quote
 
Doug Robbins - Word MVP
Guest
Posts: n/a
 
      28th Feb 2010

Use:

Dim Fkill As String
Dialogs(wdDialogFileSaveAs).Show
With ActiveDocument
Fkill = .FullName
.SaveAs .Name & " " & Format(Date, "yyyy-mm-dd")
End With
Kill Fkill


--
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, originally posted via msnews.microsoft.com

"janey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I think I must be missing something!
>
> I want to use this macro in my office templates only.
> I started with just one of them e.g. Office1.dot (which I brought over
> from Word 2003 to 2007).
> I created a macro called FileSaveAs:
>
> Sub FileSaveAs()
> '
> ' FileSaveAs Macro
> ' Saves a copy of the document in a separate file
> '
> With Dialogs(wdDialogFileSaveAs)
> If .Display Then
> With ActiveDocument
> .saveas .Name & " " & Format(Date, "yyyy-mm-dd")
> End With
> End If
> End With
> End Sub
>
> I then closed the template and opened a new document based on it. When I
> pressed Save and put in a file name, e.g. Test, I got a file called
> "Document1 2010-02-28.docx
>
> How do I get this to be: Test 2010-02-28.docx please?
>
> When I have this right, do I have to put the same macro in my other office
> templates individually?
>
>
> "Graham Mayor" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Instead of naming it FileSaveAs() call it something else and run it from
>> a toolbar button or suitable keyboard shortcut.
>> or
>> Insert the FileSaveAs macro only in the template that requires it - and
>> not the normal template.
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> "janey" <(E-Mail Removed)> wrote in message
>> news:8422EC26-6624-4404-8E3E-(E-Mail Removed)...
>>>I was very interested in this reply as I save documents in this way so it
>>>will save me having to put the date in each time I create a document.
>>>
>>> However, is there a way of NOT running this macro - e.g. if I am
>>> creating a template which does not need to have the date in the name?
>>>
>>>
>>>
>>> "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
>>> news:#(E-Mail Removed)...
>>>> Use a macro containing the following commands:
>>>>
>>>> With Dialogs(wdDialogFileSaveAs)
>>>> If .Display Then
>>>> With ActiveDocument
>>>> .SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
>>>> End With
>>>> End If
>>>> End With
>>>>
>>>> If you create the macro with the name of Sub FileSaveAs() in your
>>>> normal.dot template or in an add-in, it will run whenever the
>>>> File>SaveAs command is used.
>>>>
>>>> --
>>>> 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, originally posted via msnews.microsoft.com
>>>>
>>>> <(E-Mail Removed)> wrote in message
>>>> news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
>>>>> I have some questions hopefully someone can assist.
>>>>>
>>>>> I want to save my word documents by default in the d:\path location
>>>>> with the following format
>>>>>
>>>>> "2010-02-26 File Name.doc "- I would like to insert the date
>>>>> automatically.
>>>>>
>>>>> Appreciate your assistance.
>>>>

>>
>>

 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      1st Mar 2010
Hmmm! I am not sure how that takes us forward here. As I see it, the problem
is in the use of ActiveDocument.Name to rename the document. If the document
has not been saved this will result in
Document1 2010-03-01.docx
If the document has already been saved with that name the macro will save
with the name
Document1 2010-03-01.docx 2010-03-01.docx
You need to test whether the document has been saved and then if not prompt
for the part of the filename before the date. If then the document has been
saved, you could eliminate the date from the filename and add a new name.
This of course will delete any document of the same name saved on the same
date.
There seems little point showing the Dialog(wdDialogFileSaveAs) unless you
are going to offer the dated name to the user, and it will add confusion as
any name the user enters in the dialog will be overwritten. For a document
template for a particular task something like the following might suffice

Dim sName As String
Dim vName As Variant
With ActiveDocument
If Len(.Path) = 0 Then
.Save
sName = .name
'or instead of the previous 2 lines
'sName = InputBox("Enter filename (without the date)")
Else
vName = Split(.name, ".")
sName = Left(vName(0), Len(vName(0)) - 11)
End If
With Dialogs(wdDialogFileSaveAs)
.name = sName & " " & Format(Date, "yyyy-mm-dd")
.Show
End With
End With

If you want something a little more universally applicable - see
http://www.gmayor.com/save_numbered_versions.htm


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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
news:O$(E-Mail Removed)...
> Use:
>
> Dim Fkill As String
> Dialogs(wdDialogFileSaveAs).Show
> With ActiveDocument
> Fkill = .FullName
> .SaveAs .Name & " " & Format(Date, "yyyy-mm-dd")
> End With
> Kill Fkill
>
>
> --
> 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, originally posted via msnews.microsoft.com
>
> "janey" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I think I must be missing something!
>>
>> I want to use this macro in my office templates only.
>> I started with just one of them e.g. Office1.dot (which I brought over
>> from Word 2003 to 2007).
>> I created a macro called FileSaveAs:
>>
>> Sub FileSaveAs()
>> '
>> ' FileSaveAs Macro
>> ' Saves a copy of the document in a separate file
>> '
>> With Dialogs(wdDialogFileSaveAs)
>> If .Display Then
>> With ActiveDocument
>> .saveas .Name & " " & Format(Date, "yyyy-mm-dd")
>> End With
>> End If
>> End With
>> End Sub
>>
>> I then closed the template and opened a new document based on it. When I
>> pressed Save and put in a file name, e.g. Test, I got a file called
>> "Document1 2010-02-28.docx
>>
>> How do I get this to be: Test 2010-02-28.docx please?
>>
>> When I have this right, do I have to put the same macro in my other
>> office templates individually?
>>
>>
>> "Graham Mayor" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Instead of naming it FileSaveAs() call it something else and run it from
>>> a toolbar button or suitable keyboard shortcut.
>>> or
>>> Insert the FileSaveAs macro only in the template that requires it - and
>>> not the normal template.
>>>
>>> --
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>> Graham Mayor - Word MVP
>>>
>>> My web site www.gmayor.com
>>> Word MVP web site http://word.mvps.org
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>>
>>>
>>> "janey" <(E-Mail Removed)> wrote in message
>>> news:8422EC26-6624-4404-8E3E-(E-Mail Removed)...
>>>>I was very interested in this reply as I save documents in this way so
>>>>it will save me having to put the date in each time I create a document.
>>>>
>>>> However, is there a way of NOT running this macro - e.g. if I am
>>>> creating a template which does not need to have the date in the name?
>>>>
>>>>
>>>>
>>>> "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
>>>> news:#(E-Mail Removed)...
>>>>> Use a macro containing the following commands:
>>>>>
>>>>> With Dialogs(wdDialogFileSaveAs)
>>>>> If .Display Then
>>>>> With ActiveDocument
>>>>> .SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
>>>>> End With
>>>>> End If
>>>>> End With
>>>>>
>>>>> If you create the macro with the name of Sub FileSaveAs() in your
>>>>> normal.dot template or in an add-in, it will run whenever the
>>>>> File>SaveAs command is used.
>>>>>
>>>>> --
>>>>> 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, originally posted via msnews.microsoft.com
>>>>>
>>>>> <(E-Mail Removed)> wrote in message
>>>>> news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
>>>>>> I have some questions hopefully someone can assist.
>>>>>>
>>>>>> I want to save my word documents by default in the d:\path location
>>>>>> with the following format
>>>>>>
>>>>>> "2010-02-26 File Name.doc "- I would like to insert the date
>>>>>> automatically.
>>>>>>
>>>>>> Appreciate your assistance.
>>>>>
>>>
>>>



 
Reply With Quote
 
janey
Guest
Posts: n/a
 
      1st Mar 2010

Thanks for the suggestions.

I have tried the last two solutions but, in each case, got:

Document1.docx 2101-03-01

What I really want is:
Create new document (based on a particular template)
Save
Document1 2010-03-01.docx

Not sure how to transpose the item in the macro.


"Graham Mayor" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hmmm! I am not sure how that takes us forward here. As I see it, the
> problem is in the use of ActiveDocument.Name to rename the document. If
> the document has not been saved this will result in
> Document1 2010-03-01.docx
> If the document has already been saved with that name the macro will save
> with the name
> Document1 2010-03-01.docx 2010-03-01.docx
> You need to test whether the document has been saved and then if not
> prompt for the part of the filename before the date. If then the document
> has been saved, you could eliminate the date from the filename and add a
> new name. This of course will delete any document of the same name saved
> on the same date.
> There seems little point showing the Dialog(wdDialogFileSaveAs) unless you
> are going to offer the dated name to the user, and it will add confusion
> as any name the user enters in the dialog will be overwritten. For a
> document template for a particular task something like the following might
> suffice
>
> Dim sName As String
> Dim vName As Variant
> With ActiveDocument
> If Len(.Path) = 0 Then
> .Save
> sName = .name
> 'or instead of the previous 2 lines
> 'sName = InputBox("Enter filename (without the date)")
> Else
> vName = Split(.name, ".")
> sName = Left(vName(0), Len(vName(0)) - 11)
> End If
> With Dialogs(wdDialogFileSaveAs)
> .name = sName & " " & Format(Date, "yyyy-mm-dd")
> .Show
> End With
> End With
>
> If you want something a little more universally applicable - see
> http://www.gmayor.com/save_numbered_versions.htm
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
> news:O$(E-Mail Removed)...
>> Use:
>>
>> Dim Fkill As String
>> Dialogs(wdDialogFileSaveAs).Show
>> With ActiveDocument
>> Fkill = .FullName
>> .SaveAs .Name & " " & Format(Date, "yyyy-mm-dd")
>> End With
>> Kill Fkill
>>
>>
>> --
>> 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, originally posted via msnews.microsoft.com
>>
>> "janey" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> I think I must be missing something!
>>>
>>> I want to use this macro in my office templates only.
>>> I started with just one of them e.g. Office1.dot (which I brought over
>>> from Word 2003 to 2007).
>>> I created a macro called FileSaveAs:
>>>
>>> Sub FileSaveAs()
>>> '
>>> ' FileSaveAs Macro
>>> ' Saves a copy of the document in a separate file
>>> '
>>> With Dialogs(wdDialogFileSaveAs)
>>> If .Display Then
>>> With ActiveDocument
>>> .saveas .Name & " " & Format(Date, "yyyy-mm-dd")
>>> End With
>>> End If
>>> End With
>>> End Sub
>>>
>>> I then closed the template and opened a new document based on it. When I
>>> pressed Save and put in a file name, e.g. Test, I got a file called
>>> "Document1 2010-02-28.docx
>>>
>>> How do I get this to be: Test 2010-02-28.docx please?
>>>
>>> When I have this right, do I have to put the same macro in my other
>>> office templates individually?
>>>
>>>
>>> "Graham Mayor" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Instead of naming it FileSaveAs() call it something else and run it
>>>> from a toolbar button or suitable keyboard shortcut.
>>>> or
>>>> Insert the FileSaveAs macro only in the template that requires it - and
>>>> not the normal template.
>>>>
>>>> --
>>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>>> Graham Mayor - Word MVP
>>>>
>>>> My web site www.gmayor.com
>>>> Word MVP web site http://word.mvps.org
>>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>>>
>>>>
>>>> "janey" <(E-Mail Removed)> wrote in message
>>>> news:8422EC26-6624-4404-8E3E-(E-Mail Removed)...
>>>>>I was very interested in this reply as I save documents in this way so
>>>>>it will save me having to put the date in each time I create a
>>>>>document.
>>>>>
>>>>> However, is there a way of NOT running this macro - e.g. if I am
>>>>> creating a template which does not need to have the date in the name?
>>>>>
>>>>>
>>>>>
>>>>> "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message
>>>>> news:#(E-Mail Removed)...
>>>>>> Use a macro containing the following commands:
>>>>>>
>>>>>> With Dialogs(wdDialogFileSaveAs)
>>>>>> If .Display Then
>>>>>> With ActiveDocument
>>>>>> .SaveAs Format(Date, "yyyy-mm-dd") & " " & .Name
>>>>>> End With
>>>>>> End If
>>>>>> End With
>>>>>>
>>>>>> If you create the macro with the name of Sub FileSaveAs() in your
>>>>>> normal.dot template or in an add-in, it will run whenever the
>>>>>> File>SaveAs command is used.
>>>>>>
>>>>>> --
>>>>>> 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, originally posted via msnews.microsoft.com
>>>>>>
>>>>>> <(E-Mail Removed)> wrote in message
>>>>>> news:cbfbdc07-bed3-436f-b89d-(E-Mail Removed)...
>>>>>>> I have some questions hopefully someone can assist.
>>>>>>>
>>>>>>> I want to save my word documents by default in the d:\path location
>>>>>>> with the following format
>>>>>>>
>>>>>>> "2010-02-26 File Name.doc "- I would like to insert the date
>>>>>>> automatically.
>>>>>>>
>>>>>>> Appreciate your assistance.
>>>>>>
>>>>
>>>>

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I set up automatic path/file name for new workbooks? =?Utf-8?B?V0NIIEFTU0lTVEFOVA==?= Microsoft Excel Misc 1 11th Oct 2006 02:33 PM
automatic choose of dir path bratek Microsoft Excel Programming 3 24th Jul 2006 02:40 PM
Automatic Insertion of a File Path Paige L Microsoft Excel Worksheet Functions 2 16th Nov 2003 10:55 PM
Re: automatic file path and date Suzanne S. Barnhill Microsoft Word Document Management 0 26th Sep 2003 04:54 AM
Re: automatic file path and date Doug Robbins - Word MVP Microsoft Word Document Management 0 26th Sep 2003 03:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:02 PM.