Hi
I didn't know anything about macros and VBA for nowadays but I want to make
my documents numbered sequentially and I looked at some related sites ( such
as http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm ). Also I read 70 pages
about my subject at this site :) I changed the code as the following for me:
Sub AutoNew()
Order = System.PrivateProfileString("\\server\Counter.Txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If
System.PrivateProfileString("\\server\Counter.txt", "MacroSettings", _
"Order") = Order
ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="\\server\DocumentName Ref-06-" &
Format(Order, "00#")
End Sub
As you can see In my document I have a Ref-06-XXX part and everytime I
opened the template document it adds one to Ref like â??Ref-06-001â??,
â??Ref-06-002â??, â??Ref-06-003â??... and also it creates the document at â??\\server\â??
like â??DocumentName Ref-06-001â??, â??DocumentName Ref-06-002â??, â??DocumentName
Ref-06-003â??...
But the problem is it saves the document after it opens the new numbered
document so if i made a mistake to open a new document i should delete the
last document that was created and also change the order number in the
â??Counter.txtâ?? to -1. I hope I had explained my problem well :) So I think
about the problem and have some answers like;
* Macro shouldn't save the document at the beginning (after the creation of
the new document). It would save the document after I made changes on the
document and I think that the document have that Ref number on it. So it
should save the document after I made my changes on document (before closing
the document).
As I said at the beginning I donâ??t know VBA codes so I need help from you. I
know that this is too easy for experts. Thanks for your help this very moment
:)