From: prem on 13 Jan 2010 23:01 Hey guys, right now, I am using MS Word 2007 to issue receipts. However, I have a little issue with this. Whenever I need to issue a new receipt, I have to manually increase the receipt number by 1. For example, the first receipt I issue might have the receipt number "201001". When I need to issue the next receipt, I need to open the file and manually increase the receipt number to "210102". Sometimes I forget to do this and this leads to a number of problems. My question is, is it possible to make the receipt number update itself automatically every time I open it, such that it automatically increases by 1? Thank you in advance. Regards, Prem
From: Suzanne S. Barnhill on 14 Jan 2010 00:13 See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "prem" <prem(a)discussions.microsoft.com> wrote in message news:A86BD119-359B-4BC6-B218-1CAD080A3BBA(a)microsoft.com... > Hey guys, right now, I am using MS Word 2007 to issue receipts. However, > I > have a little issue with this. Whenever I need to issue a new receipt, I > have > to manually increase the receipt number by 1. > > For example, the first receipt I issue might have the receipt number > "201001". When I need to issue the next receipt, I need to open the file > and > manually increase the receipt number to "210102". Sometimes I forget to do > this and this leads to a number of problems. > > My question is, is it possible to make the receipt number update itself > automatically every time I open it, such that it automatically increases > by 1? > > Thank you in advance. > > Regards, > Prem >
From: prem on 14 Jan 2010 06:41 Hi I read through the article but I am not sure what to do. Right now, My invoice number (201000795) is listed at the top right-hand corner of the document. So do I highlight the number and then insert the bookmark as mentioned?? And then do I enter the macro: 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 Cause I tried that but nothing worked. "Suzanne S. Barnhill" wrote: > See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm > > -- > Suzanne S. Barnhill > Microsoft MVP (Word) > Words into Type > Fairhope, Alabama USA > http://word.mvps.org > > "prem" <prem(a)discussions.microsoft.com> wrote in message > news:A86BD119-359B-4BC6-B218-1CAD080A3BBA(a)microsoft.com... > > Hey guys, right now, I am using MS Word 2007 to issue receipts. However, > > I > > have a little issue with this. Whenever I need to issue a new receipt, I > > have > > to manually increase the receipt number by 1. > > > > For example, the first receipt I issue might have the receipt number > > "201001". When I need to issue the next receipt, I need to open the file > > and > > manually increase the receipt number to "210102". Sometimes I forget to do > > this and this leads to a number of problems. > > > > My question is, is it possible to make the receipt number update itself > > automatically every time I open it, such that it automatically increases > > by 1? > > > > Thank you in advance. > > > > Regards, > > Prem > > > > . >
From: Stefan Blom on 14 Jan 2010 07:37 After the macro has run once, and created the text file, you can edit the number in the file (just open it in NotePad). -- Stefan Blom Microsoft Word MVP "prem" <prem(a)discussions.microsoft.com> wrote in message news:EF5790FE-ED94-4B33-B92C-95524FBE5F16(a)microsoft.com... > Hi I read through the article but I am not sure what to do. > > Right now, My invoice number (201000795) is listed at the top right-hand > corner of the document. So do I highlight the number and then insert the > bookmark as mentioned?? > > And then do I enter the macro: > > 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 > > Cause I tried that but nothing worked. > > "Suzanne S. Barnhill" wrote: > >> See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm >> >> -- >> Suzanne S. Barnhill >> Microsoft MVP (Word) >> Words into Type >> Fairhope, Alabama USA >> http://word.mvps.org >> >> "prem" <prem(a)discussions.microsoft.com> wrote in message >> news:A86BD119-359B-4BC6-B218-1CAD080A3BBA(a)microsoft.com... >> > Hey guys, right now, I am using MS Word 2007 to issue receipts. >> > However, >> > I >> > have a little issue with this. Whenever I need to issue a new receipt, >> > I >> > have >> > to manually increase the receipt number by 1. >> > >> > For example, the first receipt I issue might have the receipt number >> > "201001". When I need to issue the next receipt, I need to open the >> > file >> > and >> > manually increase the receipt number to "210102". Sometimes I forget to >> > do >> > this and this leads to a number of problems. >> > >> > My question is, is it possible to make the receipt number update itself >> > automatically every time I open it, such that it automatically >> > increases >> > by 1? >> > >> > Thank you in advance. >> > >> > Regards, >> > Prem >> > >> >> . >>
From: Graham Mayor on 14 Jan 2010 08:35 Add the following to a new module in the invoice template (not the normal template) - http://www.gmayor.com/installing_macro.htm Add a bookmark called InvoiceNo at the place you want the number to appear. Save the template Run the macro ResetStartNumber to set the start number (if other than 1) Close the template Create a new document from the the template. It will be numbered with either 1 or the start number you have set. To change the number, run the reset macro again, and run the AddNumber macro to change the bookmarked number. You will find a slight variation of this technique at http://www.gmayor.com/word_vba_examples.htm#Number and more on numbering at http://www.gmayor.com/automatic_numbering_documents.htm Option Explicit Private SettingsFile As String Private Order As String Private oRng As Range Private iStart As Integer Sub AutoNew() AddNumber End Sub Sub AddNumber() 'Save invoice number in the Word startup folder. SettingsFile = Options.DefaultFilePath(wdStartupPath) & "\Settings.ini" 'or the Workgroup folder 'SettingsFile = Options.DefaultFilePath(wdWorkgroupTemplatesPath) & "\Settings.ini" Order = System.PrivateProfileString(SettingsFile, _ "InvoiceNumber", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If 'Requires a bookmark called 'InvoiceNo' at the location where the number is to be placed. System.PrivateProfileString(SettingsFile, "InvoiceNumber", _ "Order") = Order Set oRng = ActiveDocument.Bookmarks("InvoiceNo").Range oRng.Text = Format(Order, "#") ActiveDocument.Bookmarks.Add Name:="InvoiceNo", Range:=oRng End Sub Sub ResetStartNumber() SettingsFile = Options.DefaultFilePath(wdStartupPath) & "\Settings.ini" 'or the Workgroup folder 'SettingsFile = Options.DefaultFilePath(wdWorkgroupTemplatesPath) & "\Settings.ini" Order = System.PrivateProfileString(SettingsFile, _ "InvoiceNumber", "Order") If Order = "" Then Order = 1 Order = InputBox("Enter start number", , Order + 1) System.PrivateProfileString(SettingsFile, "InvoiceNumber", _ "Order") = Order - 1 End Sub -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "prem" <prem(a)discussions.microsoft.com> wrote in message news:EF5790FE-ED94-4B33-B92C-95524FBE5F16(a)microsoft.com... > Hi I read through the article but I am not sure what to do. > > Right now, My invoice number (201000795) is listed at the top right-hand > corner of the document. So do I highlight the number and then insert the > bookmark as mentioned?? > > And then do I enter the macro: > > 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 > > Cause I tried that but nothing worked. > > "Suzanne S. Barnhill" wrote: > >> See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm >> >> -- >> Suzanne S. Barnhill >> Microsoft MVP (Word) >> Words into Type >> Fairhope, Alabama USA >> http://word.mvps.org >> >> "prem" <prem(a)discussions.microsoft.com> wrote in message >> news:A86BD119-359B-4BC6-B218-1CAD080A3BBA(a)microsoft.com... >> > Hey guys, right now, I am using MS Word 2007 to issue receipts. >> > However, >> > I >> > have a little issue with this. Whenever I need to issue a new receipt, >> > I >> > have >> > to manually increase the receipt number by 1. >> > >> > For example, the first receipt I issue might have the receipt number >> > "201001". When I need to issue the next receipt, I need to open the >> > file >> > and >> > manually increase the receipt number to "210102". Sometimes I forget to >> > do >> > this and this leads to a number of problems. >> > >> > My question is, is it possible to make the receipt number update itself >> > automatically every time I open it, such that it automatically >> > increases >> > by 1? >> > >> > Thank you in advance. >> > >> > Regards, >> > Prem >> > >> >> . >>
|
Pages: 1 Prev: recommendation letter Next: Can't change margin settings |