J
JoeP
I am new at creating code for macros. I have a created a one page document
that is numbered. I would like for the number to increase (in regular
increments of 1) with each copy printed so that I do not have to manually
change the number before each print.
I found the following code at the site
http://www.word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm
but when I run the macro I get stopped at this part of the code...
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order
Here is the code I am using...
Sub AutoNew()
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.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub
Any help would be appreciated.
JoeP
that is numbered. I would like for the number to increase (in regular
increments of 1) with each copy printed so that I do not have to manually
change the number before each print.
I found the following code at the site
http://www.word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm
but when I run the macro I get stopped at this part of the code...
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order
Here is the code I am using...
Sub AutoNew()
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.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub
Any help would be appreciated.
JoeP