Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Techno Grandma Techno Grandma is offline
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Techno Grandma Techno Grandma is offline
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically linking new documents to a template DavidS Microsoft Word Help 6 January 20th 07 12:23 PM
Numbering not restarting after using Shauna Kelly's method Bothell writer Microsoft Word Help 8 September 6th 06 11:00 PM
Global Template Question Deb McLellan New Users 6 February 13th 06 03:20 PM
difference between 'regular' template and global template? Jackie D Microsoft Word Help 7 July 15th 05 10:27 PM
How can I get a Word template to remember outline numbering scheme LeslieN Microsoft Word Help 2 November 24th 04 03:36 PM


All times are GMT +1. The time now is 11:46 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"