A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I set up automatically suceeding numbers in Word?



 
 
Thread Tools Display Modes
  #41  
Old October 30th, 2007, 12:21 AM posted to microsoft.public.word.docmanagement
snulton
external usenet poster
 
Posts: 25
Default How do I set up automatically suceeding numbers in Word?

IT WORKS!!!! :-) I had to restart the computers to make sure it was holding.

THANK YOU, Scott

"Jay Freedman" wrote:

What's wrong is something simple but very easy to overlook: In each of the
PrivateProfileString expressions, you're missing a double-quote character
between Order and the closing parenthesis -- that is, you have

"MacroSettings","Order)

instead of

"MacroSettings","Order")

That applies _only_ to the occurrence immediately before the closing
parenthesis, not to the other one in the line.

By the way, I was able to get a temporary share on a server and tried this,
and it does work when you get the syntax correct. :-)

snulton wrote:
OK, I changed the AutoNew to read like this:

Sub AutoNew()

Order = System.PrivateProfileString("\\Server\data\Templat es\NRS
RemContract Sequence.Txt","MacroSettings","Order)

If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString("\\Server\data\Templat es\NRS RemContract
Sequence.Txt","MacroSettings","Order) = Order

If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If

ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order,
"04000#")

ActiveDocument.Protect wdAllowOnlyFormFields

ActiveDocument.SaveAs FileName:="path" & Format(Order, "04000#")

End Sub


And so on for NRS Bid-proposal, and NRS Service-Repair Contract,

I get Compile error:
Syntax error (with the very first line highlited);
and
Compile error:
Expected:List seperator or )

What hav I done wrong now? The pathway is a cut and paste from
accessing the templates from any of the computers.

"Jay Freedman" wrote:

The reason the numbers are per-machine is that the macro is reading
data from, and writing data to, a local file on whatever machine the
macro is currently running on. Change the macro (in the two lines
that mention System.PrivateProfileString) to read and write a file
in a shared folder, and you should get everybody working with the
same sequence -- although there's a gotcha.

Working with previous examples from this thread, you should replace

Order = System.PrivateProfileString("C:\NRS RemContract
Sequence.Txt","MacroSettings","Order)

and

System.PrivateProfileString("C:\NRS RemContract
Sequence.Txt","MacroSettings","Order) = Order

with the lines

Order = System.PrivateProfileString("\\servername\folderna me\NRS
RemContract Sequence.Txt","MacroSettings","Order)

and

System.PrivateProfileString("\\servername\folderna me\NRS
RemContract Sequence.Txt","MacroSettings","Order) = Order

Of course, I mean that "servername" should be replaced with the
actual name of the server, and "foldername" should be replaced with
the name of the shared folder. (If everybody has the same drive
letter permanently mapped to the shared folder, you can use that
instead of the servername\foldername form; but that's harder to
maintain.)

The gotcha is that there's no good way to make sure there are no
collisions -- that a macro for user A might try to read or write the
file at the same moment that user B's macro has the file open, which
would cause an error message. It should be very rare, though,
because each access to the file is very fast.


snulton wrote:
I was able to gain access to the templates by changing the level to
medium. This brought up another small challenge; the numbers are
only sequential per machine, i.e. if I am on one machine the number
that opens might be 030028 but opening from a machine that has not
accessed that template before will get 030001. Is this something
that can be made to work so that each time the template is opened
from any terminal the number will be truly sequential or arer we
limited to using only one machine to write all contracts?

"Jay Freedman" wrote:

I don't know quite what you can do -- I don't have access to a
server to try fiddling with it.

The message is the standard one you get when Word finds macros
either in any document (*.doc) or in a template from an "untrusted"
location while the macro security level is set to High. For Word
2003 and earlier, only the local Templates and Startup folders are
trusted; Word 2007 allows (theoretically, anyway) choosing other
locations to be trusted.

Go to Tools Macro Security and see what level is set -- each
computer will have its own setting, and there's no way to change
them from outside. If they're set to High, try changing them to
Medium, which should give you a choice of disabling or enabling the
macros (of course, since you know this isn't a virus, you should
choose Enable). The Low setting is not recommended.

Another thing that might work -- no promises -- is to go to Tools
Options File Locations and set the Workgroup location to point
to the folder on the server. It's worth a try.

The only thing I know that's guaranteed to work is digitally
signing the macros with a security certificate. Unless you have a
corporate security server that can issue certificates, though,
it'll cost several hundred dollars to get one from Verisign or
Thawte.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

snulton wrote:
Jay,
When I copy the templates (that work now,YEA :-) ) to my server so
other people on the network can use them, I get a MVB window that
states "The macros in this project are disabled. Please refer to
the online help or documentation of the host application to
determine how to enable macros."

This also happens when I attempt to access the templates from
other stations on the network, and when I create shortcuts to my
template folder.

If I put shortcuts to my template folder in the folder on the
server I can open the templates just fine, but only off my own
machine.

Is this a complicated work arround?




  #42  
Old October 30th, 2007, 12:58 AM posted to microsoft.public.word.docmanagement
Jay Freedman
external usenet poster
 
Posts: 9,488
Default How do I set up automatically suceeding numbers in Word?

Hallelujah! And you're welcome.

You should get some kind of award. I've been involved in longer email
threads, but I think this is my record for newsgroup threads.

--
Jay

On Mon, 29 Oct 2007 16:21:01 -0700, snulton
wrote:

IT WORKS!!!! :-) I had to restart the computers to make sure it was holding.

THANK YOU, Scott

"Jay Freedman" wrote:

What's wrong is something simple but very easy to overlook: In each of the
PrivateProfileString expressions, you're missing a double-quote character
between Order and the closing parenthesis -- that is, you have

"MacroSettings","Order)

instead of

"MacroSettings","Order")

That applies _only_ to the occurrence immediately before the closing
parenthesis, not to the other one in the line.

By the way, I was able to get a temporary share on a server and tried this,
and it does work when you get the syntax correct. :-)

snulton wrote:
OK, I changed the AutoNew to read like this:

Sub AutoNew()

Order = System.PrivateProfileString("\\Server\data\Templat es\NRS
RemContract Sequence.Txt","MacroSettings","Order)

If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString("\\Server\data\Templat es\NRS RemContract
Sequence.Txt","MacroSettings","Order) = Order

If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If

ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order,
"04000#")

ActiveDocument.Protect wdAllowOnlyFormFields

ActiveDocument.SaveAs FileName:="path" & Format(Order, "04000#")

End Sub


And so on for NRS Bid-proposal, and NRS Service-Repair Contract,

I get Compile error:
Syntax error (with the very first line highlited);
and
Compile error:
Expected:List seperator or )

What hav I done wrong now? The pathway is a cut and paste from
accessing the templates from any of the computers.

"Jay Freedman" wrote:

The reason the numbers are per-machine is that the macro is reading
data from, and writing data to, a local file on whatever machine the
macro is currently running on. Change the macro (in the two lines
that mention System.PrivateProfileString) to read and write a file
in a shared folder, and you should get everybody working with the
same sequence -- although there's a gotcha.

Working with previous examples from this thread, you should replace

Order = System.PrivateProfileString("C:\NRS RemContract
Sequence.Txt","MacroSettings","Order)

and

System.PrivateProfileString("C:\NRS RemContract
Sequence.Txt","MacroSettings","Order) = Order

with the lines

Order = System.PrivateProfileString("\\servername\folderna me\NRS
RemContract Sequence.Txt","MacroSettings","Order)

and

System.PrivateProfileString("\\servername\folderna me\NRS
RemContract Sequence.Txt","MacroSettings","Order) = Order

Of course, I mean that "servername" should be replaced with the
actual name of the server, and "foldername" should be replaced with
the name of the shared folder. (If everybody has the same drive
letter permanently mapped to the shared folder, you can use that
instead of the servername\foldername form; but that's harder to
maintain.)

The gotcha is that there's no good way to make sure there are no
collisions -- that a macro for user A might try to read or write the
file at the same moment that user B's macro has the file open, which
would cause an error message. It should be very rare, though,
because each access to the file is very fast.


snulton wrote:
I was able to gain access to the templates by changing the level to
medium. This brought up another small challenge; the numbers are
only sequential per machine, i.e. if I am on one machine the number
that opens might be 030028 but opening from a machine that has not
accessed that template before will get 030001. Is this something
that can be made to work so that each time the template is opened
from any terminal the number will be truly sequential or arer we
limited to using only one machine to write all contracts?

"Jay Freedman" wrote:

I don't know quite what you can do -- I don't have access to a
server to try fiddling with it.

The message is the standard one you get when Word finds macros
either in any document (*.doc) or in a template from an "untrusted"
location while the macro security level is set to High. For Word
2003 and earlier, only the local Templates and Startup folders are
trusted; Word 2007 allows (theoretically, anyway) choosing other
locations to be trusted.

Go to Tools Macro Security and see what level is set -- each
computer will have its own setting, and there's no way to change
them from outside. If they're set to High, try changing them to
Medium, which should give you a choice of disabling or enabling the
macros (of course, since you know this isn't a virus, you should
choose Enable). The Low setting is not recommended.

Another thing that might work -- no promises -- is to go to Tools
Options File Locations and set the Workgroup location to point
to the folder on the server. It's worth a try.

The only thing I know that's guaranteed to work is digitally
signing the macros with a security certificate. Unless you have a
corporate security server that can issue certificates, though,
it'll cost several hundred dollars to get one from Verisign or
Thawte.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

snulton wrote:
Jay,
When I copy the templates (that work now,YEA :-) ) to my server so
other people on the network can use them, I get a MVB window that
states "The macros in this project are disabled. Please refer to
the online help or documentation of the host application to
determine how to enable macros."

This also happens when I attempt to access the templates from
other stations on the network, and when I create shortcuts to my
template folder.

If I put shortcuts to my template folder in the folder on the
server I can open the templates just fine, but only off my own
machine.

Is this a complicated work arround?





--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
  #43  
Old October 30th, 2007, 04:18 PM posted to microsoft.public.word.docmanagement
snulton
external usenet poster
 
Posts: 25
Default How do I set up automatically suceeding numbers in Word?

Praise God!!!.
You have been amazingly patient with me.

Have a Great Holiday Season.

"Jay Freedman" wrote:

Hallelujah! And you're welcome.

You should get some kind of award. I've been involved in longer email
threads, but I think this is my record for newsgroup threads.

--
Jay

On Mon, 29 Oct 2007 16:21:01 -0700, snulton
wrote:

IT WORKS!!!! :-) I had to restart the computers to make sure it was holding.

THANK YOU, Scott

"Jay Freedman" wrote:

What's wrong is something simple but very easy to overlook: In each of the
PrivateProfileString expressions, you're missing a double-quote character
between Order and the closing parenthesis -- that is, you have

"MacroSettings","Order)

instead of

"MacroSettings","Order")

That applies _only_ to the occurrence immediately before the closing
parenthesis, not to the other one in the line.

By the way, I was able to get a temporary share on a server and tried this,
and it does work when you get the syntax correct. :-)

snulton wrote:
OK, I changed the AutoNew to read like this:

Sub AutoNew()

Order = System.PrivateProfileString("\\Server\data\Templat es\NRS
RemContract Sequence.Txt","MacroSettings","Order)

If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString("\\Server\data\Templat es\NRS RemContract
Sequence.Txt","MacroSettings","Order) = Order

If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If

ActiveDocument.Bookmarks("Order").Range.InsertBefo re Format(Order,
"04000#")

ActiveDocument.Protect wdAllowOnlyFormFields

ActiveDocument.SaveAs FileName:="path" & Format(Order, "04000#")

End Sub


And so on for NRS Bid-proposal, and NRS Service-Repair Contract,

I get Compile error:
Syntax error (with the very first line highlited);
and
Compile error:
Expected:List seperator or )

What hav I done wrong now? The pathway is a cut and paste from
accessing the templates from any of the computers.

"Jay Freedman" wrote:

The reason the numbers are per-machine is that the macro is reading
data from, and writing data to, a local file on whatever machine the
macro is currently running on. Change the macro (in the two lines
that mention System.PrivateProfileString) to read and write a file
in a shared folder, and you should get everybody working with the
same sequence -- although there's a gotcha.

Working with previous examples from this thread, you should replace

Order = System.PrivateProfileString("C:\NRS RemContract
Sequence.Txt","MacroSettings","Order)

and

System.PrivateProfileString("C:\NRS RemContract
Sequence.Txt","MacroSettings","Order) = Order

with the lines

Order = System.PrivateProfileString("\\servername\folderna me\NRS
RemContract Sequence.Txt","MacroSettings","Order)

and

System.PrivateProfileString("\\servername\folderna me\NRS
RemContract Sequence.Txt","MacroSettings","Order) = Order

Of course, I mean that "servername" should be replaced with the
actual name of the server, and "foldername" should be replaced with
the name of the shared folder. (If everybody has the same drive
letter permanently mapped to the shared folder, you can use that
instead of the servername\foldername form; but that's harder to
maintain.)

The gotcha is that there's no good way to make sure there are no
collisions -- that a macro for user A might try to read or write the
file at the same moment that user B's macro has the file open, which
would cause an error message. It should be very rare, though,
because each access to the file is very fast.


snulton wrote:
I was able to gain access to the templates by changing the level to
medium. This brought up another small challenge; the numbers are
only sequential per machine, i.e. if I am on one machine the number
that opens might be 030028 but opening from a machine that has not
accessed that template before will get 030001. Is this something
that can be made to work so that each time the template is opened
from any terminal the number will be truly sequential or arer we
limited to using only one machine to write all contracts?

"Jay Freedman" wrote:

I don't know quite what you can do -- I don't have access to a
server to try fiddling with it.

The message is the standard one you get when Word finds macros
either in any document (*.doc) or in a template from an "untrusted"
location while the macro security level is set to High. For Word
2003 and earlier, only the local Templates and Startup folders are
trusted; Word 2007 allows (theoretically, anyway) choosing other
locations to be trusted.

Go to Tools Macro Security and see what level is set -- each
computer will have its own setting, and there's no way to change
them from outside. If they're set to High, try changing them to
Medium, which should give you a choice of disabling or enabling the
macros (of course, since you know this isn't a virus, you should
choose Enable). The Low setting is not recommended.

Another thing that might work -- no promises -- is to go to Tools
Options File Locations and set the Workgroup location to point
to the folder on the server. It's worth a try.

The only thing I know that's guaranteed to work is digitally
signing the macros with a security certificate. Unless you have a
corporate security server that can issue certificates, though,
it'll cost several hundred dollars to get one from Verisign or
Thawte.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

snulton wrote:
Jay,
When I copy the templates (that work now,YEA :-) ) to my server so
other people on the network can use them, I get a MVB window that
states "The macros in this project are disabled. Please refer to
the online help or documentation of the host application to
determine how to enable macros."

This also happens when I attempt to access the templates from
other stations on the network, and when I create shortcuts to my
template folder.

If I put shortcuts to my template folder in the folder on the
server I can open the templates just fine, but only off my own
machine.

Is this a complicated work arround?




--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:29 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.