Well I have managed to come up with another small problem. I decided
on using the AutoNew macro by Doug Robbins and it has worked great. I
then I moved the template to another system so two other people would
have access to it (shared folder) from their PCs but the macro looks to
the local C:\Settings.txt file (on their systems) for the sequential
number. I have tried to change the pathway but I seem to be unable to
change the location of the Settings.txt file in the macro. Any ideas?
Thanks.
-Scott-
I am not sure why you cannot change the location of the Settings.txt file.
The following may not be related, but I have recently become aware that it
the user does not have administrator access under Windows XP, they are not
able to write to the root directory of the C: drive. To overcome this
problem, the following modified code should be used
Sub AutoNew()
Dim SettingsFile As String, Order as Long
SettingsFile = Options.DefaultFilePath(wdDocumentsPath) & "\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.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Well I have managed to come up with another small problem. I decided
> on using the AutoNew macro by Doug Robbins and it has worked great. I
[quoted text clipped - 5 lines]
> Thanks.
> -Scott-
stalley1995 - 28 Jan 2006 06:55 GMT
The two users have admin rights to their individual systems
(runningWindows XP Pro) and have admin rights to log onto the system I
am using for the template. The template is on a system running Windows
2000 professional. I'll try your suggestion tomorrow and once again,
thank you very much for your time and help.
-Scott-
stalley1995 - 29 Jan 2006 21:56 GMT
Doug and group;
I ran the new macro and now I am getting a new message:
run time error '13'
Type Mismatch
This is the line highlighted:
If Order = "" Then
Any suggestions?
Some additional background, I renamed the original macro from "AutoNew"
to "WorkOrderNumber" and removed the last line of the original macro in
order to control when I wanted the sequential number added to the
document. It worked beautifully until I placed it on a central Win
2000 PC and then I discovered the number would not be in sequence
depending who utilized the template.
Thanks again.
-Scott-
Doug Robbins - Word MVP - 30 Jan 2006 05:03 GMT
Change
Dim SettingsFile As String, Order as Long
to
Dim SettingsFile As String, Order as Variant

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Doug and group;
> I ran the new macro and now I am getting a new message:
[quoted text clipped - 16 lines]
> Thanks again.
> -Scott-
Graham Mayor - 30 Jan 2006 08:04 GMT
If you want the same number sequence for all users, the same settings.txt
must be at a location available to all users. If you want separate numbers
for each user then settings.txt must be set to a user location.

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Doug and group;
> I ran the new macro and now I am getting a new message:
[quoted text clipped - 16 lines]
> Thanks again.
> -Scott-
stalley1995 - 30 Jan 2006 17:01 GMT
I've tried changing the Order to Variant and that didn't solve the
problem.
The settings.txt file is located on the Win2000 system and available to
all (and both users have admin rights to the Win2000 box).
Unfortunately, the two XP systems which access the folder for the
templates insist on using their local C: drives and have set up their
own Settings.txt files and there in lies the problem. I've tried
different approaches to pointing to the folder where the template and
Settings.txt file resides on the Win2000 system but so far no luck.
Any other suggestions?
Again, thanks so much for everyones help.
-Scott-
Jay Freedman - 30 Jan 2006 18:41 GMT
> I've tried changing the Order to Variant and that didn't solve the
> problem.
[quoted text clipped - 9 lines]
> Again, thanks so much for everyones help.
> -Scott-
Hi Scott,
Reading through the thread, it looks like you have two separate problems.
Fixing either one alone won't help.
One problem is getting both XP systems to see the Settings.txt file on the
Win2000 system. To fix that, you need to edit the two lines in the macro
that say
System.PrivateProfileString("C:\Settings.Txt",
so the path points to the shared location on the Win2000 system instead of
the local C: drive. You haven't said whether the XP systems have a drive
mapped to the Win2000 system (so it might be "X:\somefolder\Settings.txt")
or whether they get access through a UNC address like
"\\server\share\Settings.txt", but either way should work.
The second problem is the error 13 "type mismatch". Declaring the variable
Order as a Variant should have fixed that.

Signature
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.
Doug Robbins - Word MVP - 30 Jan 2006 18:46 GMT
Do you mean the "Run time error '13' Type Mismatch" problem, or some other
problem.
In the template(s), you must set the path to the Settings.txt file to a
folder to which all users have read/write access. It you want multiple
users to be able to obtain numbers from the one sequence, this path will NOT
be to their c: drive.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> I've tried changing the Order to Variant and that didn't solve the
> problem.
[quoted text clipped - 9 lines]
> Again, thanks so much for everyones help.
> -Scott-
stalley1995 - 31 Jan 2006 17:14 GMT
Gentlemen:
I used the UNC path to the Settings.Txt file and now everything is
working well. Thank you so much for all your help, I really, really
appreciate it.
-Scott-