View Single Post
  #37   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default How do I set up automatically suceeding numbers in Word?

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?