Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Sequential Invoice numbering on forms using macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 09 May 2006 16:02 GMT
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
Doug Robbins - Word MVP - 09 May 2006 20:28 GMT
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#")

Signature

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

> Hi,
>
[quoted text clipped - 24 lines]
>
> End Sub
Steve - 09 May 2006 21:32 GMT
Fantastic!

Thanks Doug.

> Insert the path to the desired folder into the following line of code
>
[quoted text clipped - 35 lines]
> >
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.