B
Bill
I am trying to use AutoNew() to automatically set the title of the new
documents based upon the Normal.dot template, and thereby changing the
default save as name to this new title...
Sub AutoNew()
fname = Format(Now(), "yyyyMMdd ")
Dim dp As Object
Set dp = ActiveDocument.BuiltInDocumentProperties
dp("Title") = fname
End Sub
I have a couple of issues.
1. AutoNew isn't firing from Normal.dot, I've used the identical code in
other templates, but for some reason it's not working from Normal.dot
2. The properties box shows that the Title is being updated to the correct
format (YYYYMMdd), but Word isn't using this as the file name. Sometimes it
uses the first few words of the document, other times it uses a date, but the
wrong one(?!). I have NO idea why the incorrect date would be used because
A. there is no default title name in the template, B. that particular date is
not found anywhere in the document and C. that date was last saturday, when
none of these documents were touched.
My ultimate goal in using this macro is to have the current date in YYYYMMdd
format when the file is saved/save as. However, simply plugging that in
using FileSave() or FileSaveAs() doesn't work (based onthe examples I've
seen) because the user will need to add additional file name information
after the date.
If anyone can help me out or suggest a better/easier/more efficient method
it is appreciated. Thanks
documents based upon the Normal.dot template, and thereby changing the
default save as name to this new title...
Sub AutoNew()
fname = Format(Now(), "yyyyMMdd ")
Dim dp As Object
Set dp = ActiveDocument.BuiltInDocumentProperties
dp("Title") = fname
End Sub
I have a couple of issues.
1. AutoNew isn't firing from Normal.dot, I've used the identical code in
other templates, but for some reason it's not working from Normal.dot
2. The properties box shows that the Title is being updated to the correct
format (YYYYMMdd), but Word isn't using this as the file name. Sometimes it
uses the first few words of the document, other times it uses a date, but the
wrong one(?!). I have NO idea why the incorrect date would be used because
A. there is no default title name in the template, B. that particular date is
not found anywhere in the document and C. that date was last saturday, when
none of these documents were touched.
My ultimate goal in using this macro is to have the current date in YYYYMMdd
format when the file is saved/save as. However, simply plugging that in
using FileSave() or FileSaveAs() doesn't work (based onthe examples I've
seen) because the user will need to add additional file name information
after the date.
If anyone can help me out or suggest a better/easier/more efficient method
it is appreciated. Thanks