Sequential Invoice numbering on forms using macro

S

Steve

Hi,

Once the word form is completed the word document is automaticly saved to
either the desktop or in the My Documents folder. Is it possible to
automaticly store these files to my chosen folder rather than the default
folder using the following code.

Private Sub Document_New()

End Sub
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, "100#")
ActiveDocument.SaveAs FileName:="Quotation ID_" & Format(Order, "100#")

End Sub
 
D

Doug Robbins - Word MVP

Insert the path to the desired folder into the following line of code

ActiveDocument.SaveAs FileName:="Quotation ID_" & Format(Order, "100#")

between the " and the Q of Quotation

e.g.

ActiveDocument.SaveAs FileName:="c:\invoices\Quotation ID_" & Format(Order,
"100#")


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Steve

Fantastic!

Thanks Doug.

Doug Robbins - Word MVP said:
Insert the path to the desired folder into the following line of code

ActiveDocument.SaveAs FileName:="Quotation ID_" & Format(Order, "100#")

between the " and the Q of Quotation

e.g.

ActiveDocument.SaveAs FileName:="c:\invoices\Quotation ID_" & Format(Order,
"100#")


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top