Home |
Search |
Today's Posts |
#1
|
|||
|
|||
How do i insert sequential numbers into a Word document template?
I have a document template in Word which I use as an Invoice and I want the
numbers to automatically update as I use it. Is this possible? |
#2
|
|||
|
|||
Jo wrote:
I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#3
|
|||
|
|||
I have looked at that but am a novice and don't really understand it -
although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#4
|
|||
|
|||
Here are instructions for putting the macro into your template:
http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#5
|
|||
|
|||
Thanks a lot - managed it in the end!!
Jo "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
"Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
I'm confused! I followed the instructions and copied the NumberDocs macro
into my normal.dot / newmacros template. I inserted the bookmark "order" in the space after Invoice# and saved the Invoice template. But when I open a new document from the template I get a run-time error that says Method 'PrivateProfileString' of object 'System' failed. The run-time error is numbered '-2147467259 (80004005)'. Can you help me figure out what I did wrong??? I read all the help files about ERR object properties and tried ON ERROR RESUME NEXT statement. That produced a document with invoice number 001001, and each successive iteration added another 001 to the string. ie. 001001001 etc. Thank you in advance... ddiamondave "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
You didn't follow the instructions, which say that you should put the
autonew macro not in normal.dot, but in the document template ie in your invoice template. The macro itself is fairly straightforward and shouldn't cause any problems. You'll find an essentially similar version at http://www.gmayor.com/automatic_numbering_documents.htm though this one doesn't use a bookmark to locate the number, but places it in the header. Both macros work correctly if you follow the instructions provided. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: I'm confused! I followed the instructions and copied the NumberDocs macro into my normal.dot / newmacros template. I inserted the bookmark "order" in the space after Invoice# and saved the Invoice template. But when I open a new document from the template I get a run-time error that says Method 'PrivateProfileString' of object 'System' failed. The run-time error is numbered '-2147467259 (80004005)'. Can you help me figure out what I did wrong??? I read all the help files about ERR object properties and tried ON ERROR RESUME NEXT statement. That produced a document with invoice number 001001, and each successive iteration added another 001 to the string. ie. 001001001 etc. Thank you in advance... ddiamondave "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
Please explain. The following is instruction 2 pasted from your idiots guide:
In the field directly beneath the macro names list box, pick which template or document you wish the macro to be saved in. If you select 'All active templates and documents' - as here - the macro will be saved in the normal template. instruction 3 is 'create' instruction 4 thru 6 cut and paste the macro text... and instruction 7 saves it I've been in my invoice template throughout this proceedure. What am I missing??? "Graham Mayor" wrote: You didn't follow the instructions, which say that you should put the autonew macro not in normal.dot, but in the document template ie in your invoice template. The macro itself is fairly straightforward and shouldn't cause any problems. You'll find an essentially similar version at http://www.gmayor.com/automatic_numbering_documents.htm though this one doesn't use a bookmark to locate the number, but places it in the header. Both macros work correctly if you follow the instructions provided. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: I'm confused! I followed the instructions and copied the NumberDocs macro into my normal.dot / newmacros template. I inserted the bookmark "order" in the space after Invoice# and saved the Invoice template. But when I open a new document from the template I get a run-time error that says Method 'PrivateProfileString' of object 'System' failed. The run-time error is numbered '-2147467259 (80004005)'. Can you help me figure out what I did wrong??? I read all the help files about ERR object properties and tried ON ERROR RESUME NEXT statement. That produced a document with invoice number 001001, and each successive iteration added another 001 to the string. ie. 001001001 etc. Thank you in advance... ddiamondave "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#10
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
What you are missing is that Word, by default, always saves macros in
normal.dot. You have to tell it to save them in your template (even if that template is open for editing). This is illustrated at instruction 2 that you have quoted. There the macro is saved in normal.dot. You need it to be in your invoice document template. Cut and paste it to the correct location. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: Please explain. The following is instruction 2 pasted from your idiots guide: In the field directly beneath the macro names list box, pick which template or document you wish the macro to be saved in. If you select 'All active templates and documents' - as here - the macro will be saved in the normal template. instruction 3 is 'create' instruction 4 thru 6 cut and paste the macro text... and instruction 7 saves it I've been in my invoice template throughout this proceedure. What am I missing??? "Graham Mayor" wrote: You didn't follow the instructions, which say that you should put the autonew macro not in normal.dot, but in the document template ie in your invoice template. The macro itself is fairly straightforward and shouldn't cause any problems. You'll find an essentially similar version at http://www.gmayor.com/automatic_numbering_documents.htm though this one doesn't use a bookmark to locate the number, but places it in the header. Both macros work correctly if you follow the instructions provided. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: I'm confused! I followed the instructions and copied the NumberDocs macro into my normal.dot / newmacros template. I inserted the bookmark "order" in the space after Invoice# and saved the Invoice template. But when I open a new document from the template I get a run-time error that says Method 'PrivateProfileString' of object 'System' failed. The run-time error is numbered '-2147467259 (80004005)'. Can you help me figure out what I did wrong??? I read all the help files about ERR object properties and tried ON ERROR RESUME NEXT statement. That produced a document with invoice number 001001, and each successive iteration added another 001 to the string. ie. 001001001 etc. Thank you in advance... ddiamondave "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#11
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
It's still not working. I copied the AUTONEW macro to the newmacros module in
my invoice template, saved the template as directed. When I open a new doc from the template I get the same run-time error. My operating system is VISTA, could that cause the failure? I've search for the file "Settings.txt" and can't find it. "Graham Mayor" wrote: What you are missing is that Word, by default, always saves macros in normal.dot. You have to tell it to save them in your template (even if that template is open for editing). This is illustrated at instruction 2 that you have quoted. There the macro is saved in normal.dot. You need it to be in your invoice document template. Cut and paste it to the correct location. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: Please explain. The following is instruction 2 pasted from your idiots guide: In the field directly beneath the macro names list box, pick which template or document you wish the macro to be saved in. If you select 'All active templates and documents' - as here - the macro will be saved in the normal template. instruction 3 is 'create' instruction 4 thru 6 cut and paste the macro text... and instruction 7 saves it I've been in my invoice template throughout this proceedure. What am I missing??? "Graham Mayor" wrote: You didn't follow the instructions, which say that you should put the autonew macro not in normal.dot, but in the document template ie in your invoice template. The macro itself is fairly straightforward and shouldn't cause any problems. You'll find an essentially similar version at http://www.gmayor.com/automatic_numbering_documents.htm though this one doesn't use a bookmark to locate the number, but places it in the header. Both macros work correctly if you follow the instructions provided. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: I'm confused! I followed the instructions and copied the NumberDocs macro into my normal.dot / newmacros template. I inserted the bookmark "order" in the space after Invoice# and saved the Invoice template. But when I open a new document from the template I get a run-time error that says Method 'PrivateProfileString' of object 'System' failed. The run-time error is numbered '-2147467259 (80004005)'. Can you help me figure out what I did wrong??? I read all the help files about ERR object properties and tried ON ERROR RESUME NEXT statement. That produced a document with invoice number 001001, and each successive iteration added another 001 to the string. ie. 001001001 etc. Thank you in advance... ddiamondave "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#12
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
The error message concerns the file save location. I don't have Vista so I
cannot test whether Vista will let you write to the root of the C drive, however with a small change the macro will change to a different folder - in the following example the Word Startup Folder. So try the following variation The line SettingsFile="C:\Path\Settings.txt" is an alternative for the line that follows should you wish to nominate a specific folder that you have write access to, to store the settings.txt file. Sub AutoNew() Dim SettingsFile As String 'SettingsFile="C:\Path\Settings.txt" SettingsFile = Options.DefaultFilePath(wdStartupPath) & "\Settings.txt" Order = System.PrivateProfileString(SettingsFile, _ "MacroSettings", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If System.PrivateProfileString(SettingsFile, "MacroSettings", _ "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#") End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: It's still not working. I copied the AUTONEW macro to the newmacros module in my invoice template, saved the template as directed. When I open a new doc from the template I get the same run-time error. My operating system is VISTA, could that cause the failure? I've search for the file "Settings.txt" and can't find it. "Graham Mayor" wrote: What you are missing is that Word, by default, always saves macros in normal.dot. You have to tell it to save them in your template (even if that template is open for editing). This is illustrated at instruction 2 that you have quoted. There the macro is saved in normal.dot. You need it to be in your invoice document template. Cut and paste it to the correct location. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: Please explain. The following is instruction 2 pasted from your idiots guide: In the field directly beneath the macro names list box, pick which template or document you wish the macro to be saved in. If you select 'All active templates and documents' - as here - the macro will be saved in the normal template. instruction 3 is 'create' instruction 4 thru 6 cut and paste the macro text... and instruction 7 saves it I've been in my invoice template throughout this proceedure. What am I missing??? "Graham Mayor" wrote: You didn't follow the instructions, which say that you should put the autonew macro not in normal.dot, but in the document template ie in your invoice template. The macro itself is fairly straightforward and shouldn't cause any problems. You'll find an essentially similar version at http://www.gmayor.com/automatic_numbering_documents.htm though this one doesn't use a bookmark to locate the number, but places it in the header. Both macros work correctly if you follow the instructions provided. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: I'm confused! I followed the instructions and copied the NumberDocs macro into my normal.dot / newmacros template. I inserted the bookmark "order" in the space after Invoice# and saved the Invoice template. But when I open a new document from the template I get a run-time error that says Method 'PrivateProfileString' of object 'System' failed. The run-time error is numbered '-2147467259 (80004005)'. Can you help me figure out what I did wrong??? I read all the help files about ERR object properties and tried ON ERROR RESUME NEXT statement. That produced a document with invoice number 001001, and each successive iteration added another 001 to the string. ie. 001001001 etc. Thank you in advance... ddiamondave "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#13
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
Thank you so very much! Now it works the way it should. You have made my day.
"Graham Mayor" wrote: The error message concerns the file save location. I don't have Vista so I cannot test whether Vista will let you write to the root of the C drive, however with a small change the macro will change to a different folder - in the following example the Word Startup Folder. So try the following variation The line SettingsFile="C:\Path\Settings.txt" is an alternative for the line that follows should you wish to nominate a specific folder that you have write access to, to store the settings.txt file. Sub AutoNew() Dim SettingsFile As String 'SettingsFile="C:\Path\Settings.txt" SettingsFile = Options.DefaultFilePath(wdStartupPath) & "\Settings.txt" Order = System.PrivateProfileString(SettingsFile, _ "MacroSettings", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If System.PrivateProfileString(SettingsFile, "MacroSettings", _ "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#") End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: It's still not working. I copied the AUTONEW macro to the newmacros module in my invoice template, saved the template as directed. When I open a new doc from the template I get the same run-time error. My operating system is VISTA, could that cause the failure? I've search for the file "Settings.txt" and can't find it. "Graham Mayor" wrote: What you are missing is that Word, by default, always saves macros in normal.dot. You have to tell it to save them in your template (even if that template is open for editing). This is illustrated at instruction 2 that you have quoted. There the macro is saved in normal.dot. You need it to be in your invoice document template. Cut and paste it to the correct location. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: Please explain. The following is instruction 2 pasted from your idiots guide: In the field directly beneath the macro names list box, pick which template or document you wish the macro to be saved in. If you select 'All active templates and documents' - as here - the macro will be saved in the normal template. instruction 3 is 'create' instruction 4 thru 6 cut and paste the macro text... and instruction 7 saves it I've been in my invoice template throughout this proceedure. What am I missing??? "Graham Mayor" wrote: You didn't follow the instructions, which say that you should put the autonew macro not in normal.dot, but in the document template ie in your invoice template. The macro itself is fairly straightforward and shouldn't cause any problems. You'll find an essentially similar version at http://www.gmayor.com/automatic_numbering_documents.htm though this one doesn't use a bookmark to locate the number, but places it in the header. Both macros work correctly if you follow the instructions provided. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: I'm confused! I followed the instructions and copied the NumberDocs macro into my normal.dot / newmacros template. I inserted the bookmark "order" in the space after Invoice# and saved the Invoice template. But when I open a new document from the template I get a run-time error that says Method 'PrivateProfileString' of object 'System' failed. The run-time error is numbered '-2147467259 (80004005)'. Can you help me figure out what I did wrong??? I read all the help files about ERR object properties and tried ON ERROR RESUME NEXT statement. That produced a document with invoice number 001001, and each successive iteration added another 001 to the string. ie. 001001001 etc. Thank you in advance... ddiamondave "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#14
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do i insert sequential numbers into a Word document templa
You are welcome
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: Thank you so very much! Now it works the way it should. You have made my day. "Graham Mayor" wrote: The error message concerns the file save location. I don't have Vista so I cannot test whether Vista will let you write to the root of the C drive, however with a small change the macro will change to a different folder - in the following example the Word Startup Folder. So try the following variation The line SettingsFile="C:\Path\Settings.txt" is an alternative for the line that follows should you wish to nominate a specific folder that you have write access to, to store the settings.txt file. Sub AutoNew() Dim SettingsFile As String 'SettingsFile="C:\Path\Settings.txt" SettingsFile = Options.DefaultFilePath(wdStartupPath) & "\Settings.txt" Order = System.PrivateProfileString(SettingsFile, _ "MacroSettings", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If System.PrivateProfileString(SettingsFile, "MacroSettings", _ "Order") = Order ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order, "00#") ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#") End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: It's still not working. I copied the AUTONEW macro to the newmacros module in my invoice template, saved the template as directed. When I open a new doc from the template I get the same run-time error. My operating system is VISTA, could that cause the failure? I've search for the file "Settings.txt" and can't find it. "Graham Mayor" wrote: What you are missing is that Word, by default, always saves macros in normal.dot. You have to tell it to save them in your template (even if that template is open for editing). This is illustrated at instruction 2 that you have quoted. There the macro is saved in normal.dot. You need it to be in your invoice document template. Cut and paste it to the correct location. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: Please explain. The following is instruction 2 pasted from your idiots guide: In the field directly beneath the macro names list box, pick which template or document you wish the macro to be saved in. If you select 'All active templates and documents' - as here - the macro will be saved in the normal template. instruction 3 is 'create' instruction 4 thru 6 cut and paste the macro text... and instruction 7 saves it I've been in my invoice template throughout this proceedure. What am I missing??? "Graham Mayor" wrote: You didn't follow the instructions, which say that you should put the autonew macro not in normal.dot, but in the document template ie in your invoice template. The macro itself is fairly straightforward and shouldn't cause any problems. You'll find an essentially similar version at http://www.gmayor.com/automatic_numbering_documents.htm though this one doesn't use a bookmark to locate the number, but places it in the header. Both macros work correctly if you follow the instructions provided. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ddiamondave wrote: I'm confused! I followed the instructions and copied the NumberDocs macro into my normal.dot / newmacros template. I inserted the bookmark "order" in the space after Invoice# and saved the Invoice template. But when I open a new document from the template I get a run-time error that says Method 'PrivateProfileString' of object 'System' failed. The run-time error is numbered '-2147467259 (80004005)'. Can you help me figure out what I did wrong??? I read all the help files about ERR object properties and tried ON ERROR RESUME NEXT statement. That produced a document with invoice number 001001, and each successive iteration added another 001 to the string. ie. 001001001 etc. Thank you in advance... ddiamondave "Jay Freedman" wrote: Here are instructions for putting the macro into your template: http://www.gmayor.com/installing_macro.htm All you need to do is copy the macro from the NumberDocs web page and paste it into the macro editor the way the installing_macro article describes. In the body of the template, insert the bookmark named Order where the number should appear. Then save the template. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Jo wrote: I have looked at that but am a novice and don't really understand it - although I have tried to do it!! Jo "Jay Freedman" wrote: Jo wrote: I have a document template in Word which I use as an Invoice and I want the numbers to automatically update as I use it. Is this possible? See http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please give us REVEAL CODES like WORD PERFECT not reveal codes in. | Microsoft Word Help | |||
Does Word have Keyboard Merges like Word Perfect does? | Mailmerge | |||
Word2000 letterhead merge | Mailmerge | |||
Underscore (_) will not always display in RTF files (Word 2002). | Microsoft Word Help | |||
Wordperfect Office 2000 conversion to Word 2003 | New Users |