Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
need help with numbering in template
Using word 2002. wish to set document to have a number which would change
each time a new document was opened. Example go file/new and open the custom template letter, the letter has an area that says 2007-01. the next time the template is opened this number would be 2007-02 and so on. Then next year you start all over with 2008-01. Is this possible and if so how do you do it.... thanks |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
need help with numbering in template
See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm or using the registry
(for a single user system) http://www.gmayor.com/automatic_numbering_documents.htm Both methods can be adapted to include the year - e.g. in Doug's macro (first link) change the last two lines to ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Date, "yyyy" & "-") & Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Date, "yyyy" & "-") & Format(Order, "00#") -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Techno Grandma wrote: Using word 2002. wish to set document to have a number which would change each time a new document was opened. Example go file/new and open the custom template letter, the letter has an area that says 2007-01. the next time the template is opened this number would be 2007-02 and so on. Then next year you start all over with 2008-01. Is this possible and if so how do you do it.... thanks |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
need help with numbering in template
I managed to get the macro in the template.
When I open a new document it keeps opening at 003 What have I done wrong... I used the auto new macro: here is the code: Sub invoicenumber() ' ' invoicenumber Macro ' Macro created 1/28/2007 by me ' Order = System.PrivateProfileString("C:\Settings.Txt", _ "MacroSettings", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _ "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#") End Sub "Graham Mayor" wrote: See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm or using the registry (for a single user system) http://www.gmayor.com/automatic_numbering_documents.htm Both methods can be adapted to include the year - e.g. in Doug's macro (first link) change the last two lines to ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Date, "yyyy" & "-") & Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Date, "yyyy" & "-") & Format(Order, "00#") -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Techno Grandma wrote: Using word 2002. wish to set document to have a number which would change each time a new document was opened. Example go file/new and open the custom template letter, the letter has an area that says 2007-01. the next time the template is opened this number would be 2007-02 and so on. Then next year you start all over with 2008-01. Is this possible and if so how do you do it.... thanks |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
need help with numbering in template
While testing you have written entries to settings.txt. Open settings.txt
and delete the line order=002 and start again. The number here is always the last number used. It might reduce confusion if you change all incidences of 'Order' to 'Invoice' - including the bookmark! -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Techno Grandma wrote: I managed to get the macro in the template. When I open a new document it keeps opening at 003 What have I done wrong... I used the auto new macro: here is the code: Sub invoicenumber() ' ' invoicenumber Macro ' Macro created 1/28/2007 by me ' Order = System.PrivateProfileString("C:\Settings.Txt", _ "MacroSettings", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _ "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#") End Sub "Graham Mayor" wrote: See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm or using the registry (for a single user system) http://www.gmayor.com/automatic_numbering_documents.htm Both methods can be adapted to include the year - e.g. in Doug's macro (first link) change the last two lines to ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Date, "yyyy" & "-") & Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Date, "yyyy" & "-") & Format(Order, "00#") -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Techno Grandma wrote: Using word 2002. wish to set document to have a number which would change each time a new document was opened. Example go file/new and open the custom template letter, the letter has an area that says 2007-01. the next time the template is opened this number would be 2007-02 and so on. Then next year you start all over with 2008-01. Is this possible and if so how do you do it.... thanks |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
need help with numbering in template
Incidentally "path" in the line
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#") represents the actual path to the folder where the document will be saved. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: While testing you have written entries to settings.txt. Open settings.txt and delete the line order=002 and start again. The number here is always the last number used. It might reduce confusion if you change all incidences of 'Order' to 'Invoice' - including the bookmark! Techno Grandma wrote: I managed to get the macro in the template. When I open a new document it keeps opening at 003 What have I done wrong... I used the auto new macro: here is the code: Sub invoicenumber() ' ' invoicenumber Macro ' Macro created 1/28/2007 by me ' Order = System.PrivateProfileString("C:\Settings.Txt", _ "MacroSettings", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _ "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#") End Sub "Graham Mayor" wrote: See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm or using the registry (for a single user system) http://www.gmayor.com/automatic_numbering_documents.htm Both methods can be adapted to include the year - e.g. in Doug's macro (first link) change the last two lines to ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Date, "yyyy" & "-") & Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Date, "yyyy" & "-") & Format(Order, "00#") -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Techno Grandma wrote: Using word 2002. wish to set document to have a number which would change each time a new document was opened. Example go file/new and open the custom template letter, the letter has an area that says 2007-01. the next time the template is opened this number would be 2007-02 and so on. Then next year you start all over with 2008-01. Is this possible and if so how do you do it.... thanks |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automatically linking new documents to a template | Microsoft Word Help | |||
Numbering not restarting after using Shauna Kelly's method | Microsoft Word Help | |||
Global Template Question | New Users | |||
difference between 'regular' template and global template? | Microsoft Word Help | |||
How can I get a Word template to remember outline numbering scheme | Microsoft Word Help |