Reply
 
Thread Tools Display Modes
  #1   Report Post  
Jo
 
Posts: n/a
Default 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   Report Post  
Jay Freedman
 
Posts: n/a
Default

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   Report Post  
Jo
 
Posts: n/a
Default

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   Report Post  
Jay Freedman
 
Posts: n/a
Default

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   Report Post  
Jo
 
Posts: n/a
Default

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   Report Post  
Posted to microsoft.public.word.docmanagement
ddiamondave ddiamondave is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
ddiamondave ddiamondave is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
ddiamondave ddiamondave is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
ddiamondave ddiamondave is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
ddiamondave ddiamondave is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please give us REVEAL CODES like WORD PERFECT not reveal codes in. Rachel King Microsoft Word Help 38 August 21st 09 09:54 PM
Does Word have Keyboard Merges like Word Perfect does? Donnas Mailmerge 1 June 28th 05 09:30 PM
Word2000 letterhead merge BAW Mailmerge 3 June 25th 05 01:17 PM
Underscore (_) will not always display in RTF files (Word 2002). David A Edge Microsoft Word Help 6 June 14th 05 10:39 AM
Wordperfect Office 2000 conversion to Word 2003 MikeE New Users 1 March 21st 05 12:04 AM


All times are GMT +1. The time now is 05:37 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"