Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
I created a PO with an "AutoNew" number bookmarked.
Please look at my formula and tell my why this doesn't advance to the next sequential number when I open the template as "New". ***I wanted to start the numbering at 17999 so the next NEW one opened would be 18000...etc.*** Sub AutoNew() Order = System.PrivateProfileString("C:\Settings.Txt", "MacroSettings", "Order") If Order = "" Then Order = 17999 Else Order = Order + 1 End If System.PrivateProfileString("C:\Settings.txt", "MacroSettings", "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "17999") ActiveDocument.SaveAs FileName:="Purchase Order" & Format(Order, "17999") ' AutoNew Macro ' Macro recorded 1/26/2007 by Patricia Richardson ' End Sub |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Hi Patty,
If only one person is going to use the Settings.txt file, you could set the Order number in the file to be 17999 and then in your code replace the "If .. Then .. Else .. End If" block with just "Order=Order + 1". If several people are going to use the file and the Order number in the file may be blank (or the file not exist initially) then in your code leave the "If .. Then .. Else .. End If" block and change "Order = 17999" to "Order = 18000" Also, the "Format" lines in the code need a little alteration. The first value in the Format function is the thing that you want to format and the second value is a "picture" of how you want it to be formatted. If you want the order numbers to display with leading zeroes then change the Format functions to "Format(Order, "00000")". If you want the order numbers to display without leading zeroes then change the Format functions to "Format(Order, "#####")". Cheers. Ed "Patty" wrote: I created a PO with an "AutoNew" number bookmarked. Please look at my formula and tell my why this doesn't advance to the next sequential number when I open the template as "New". ***I wanted to start the numbering at 17999 so the next NEW one opened would be 18000...etc.*** Sub AutoNew() Order = System.PrivateProfileString("C:\Settings.Txt", "MacroSettings", "Order") If Order = "" Then Order = 17999 Else Order = Order + 1 End If System.PrivateProfileString("C:\Settings.txt", "MacroSettings", "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "17999") ActiveDocument.SaveAs FileName:="Purchase Order" & Format(Order, "17999") ' AutoNew Macro ' Macro recorded 1/26/2007 by Patricia Richardson ' End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Purchase Order Template WOES | Microsoft Word Help | |||
How do you use a template? | Microsoft Word Help | |||
Features | Microsoft Word Help | |||
Global Template Question | New Users | |||
CPU Usage When working with a Template I Created | Microsoft Word Help |