Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Patty Patty is offline
external usenet poster
 
Posts: 31
Default Purchase Order Template Question

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   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 217
Default Purchase Order Template Question

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

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Purchase Order Template WOES Patty Microsoft Word Help 6 January 27th 07 11:04 PM
How do you use a template? TheWheel Microsoft Word Help 10 August 25th 06 04:34 PM
Features godmongo Microsoft Word Help 20 July 22nd 06 07:37 AM
Global Template Question Deb McLellan New Users 6 February 13th 06 03:20 PM
CPU Usage When working with a Template I Created KM1 Microsoft Word Help 6 May 24th 05 04:38 PM


All times are GMT +1. The time now is 08:41 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"