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 / March 2005

Tip: Looking for answers? Try searching our database.

incrementing invoice number on word template

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
allan - 29 Mar 2005 03:11 GMT
Hi
I am trying to create a word template that has a number that increments with
each new document created.
So far I have worked from kb212686 and that is fine, but I would like to
have the number so that it is to five signicant digits.
eg
5 would be 00005
101 would be 00101
and so forth
If anyone has got any ideas on how to achieve this I would be very
appreciative to know.
Dave Lett - 29 Mar 2005 12:53 GMT
Hi Allan,

Does the following routine help you work out how to increment to five
significant digits?

Dim iCount As Integer
Dim sCount As String
For iCount = 1 To 10
   If Len(iCount) < 5 Then
       Select Case Len(CStr(iCount))
           Case 1
               sCount = "0000" & iCount
           Case 2
               sCount = "000" & iCount
           ''' and so on through 4 cases
           Case Else
       End Select
   End If
   Debug.Print sCount
Next iCount

> Hi
> I am trying to create a word template that has a number that increments with
[quoted text clipped - 7 lines]
> If anyone has got any ideas on how to achieve this I would be very
> appreciative to know.
allan - 30 Mar 2005 05:27 GMT
Hi Dave,

I got reply in another section and was directed to
http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm

This did the trick perfectly. All I had to do was edit it for 5 sig figures
instead of 3.
I had a play with your code and it almost worked (doubtless something I am
doing), so I will keep it aside for a rainy day and have it as an alternative.

Many thanks

> Hi Allan,
>
[quoted text clipped - 29 lines]
> > If anyone has got any ideas on how to achieve this I would be very
> > appreciative to know.

Rate this thread:






 
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.