J
James
Hi Everyone,
i hope i'm not using improper etiquette here, i posted this on
Microsoft.public.word.newusers first and as recommended to come here:
I have code in a Word template that, upon SAVE, should save to the
same folder that the .Dat file exists. However, for myself and one
other user it saves a completely different drive on the network. I
have about 30 people using the template, and everyone else seems to
be ok. My guess is that i tried to save this template to my C Drive
and somehow created a .dat file somewhere else that i can't find. Any ideas?
It's Word
2003 on Windows 2000.
here is the code:
Option Explicit
Public Function GetOrderNum() As String
Dim sPath As String
'Point to the data file with the same name
sPath = Left(Me.FullName, Len(Me.FullName) - 3) & "dat"
'Read the ordernum from the file
GetOrderNum = System.PrivateProfileString(sPath, "Settings", "OrderNum")
'if the ordernum key is missing or it is a new file then start at 1
If GetOrderNum = "" Then
GetOrderNum = "1"
End If
'Write the updated value back to the file
System.PrivateProfileString(sPath, "Settings", "OrderNum") =
CStr(CInt(GetOrderNum) + 1)
'Format the Order number with leading zeros
GetOrderNum = Format(GetOrderNum, "00000")
GetOrderNum = "DEL" & GetOrderNum
End Function
TIA
James
i hope i'm not using improper etiquette here, i posted this on
Microsoft.public.word.newusers first and as recommended to come here:
I have code in a Word template that, upon SAVE, should save to the
same folder that the .Dat file exists. However, for myself and one
other user it saves a completely different drive on the network. I
have about 30 people using the template, and everyone else seems to
be ok. My guess is that i tried to save this template to my C Drive
and somehow created a .dat file somewhere else that i can't find. Any ideas?
It's Word
2003 on Windows 2000.
here is the code:
Option Explicit
Public Function GetOrderNum() As String
Dim sPath As String
'Point to the data file with the same name
sPath = Left(Me.FullName, Len(Me.FullName) - 3) & "dat"
'Read the ordernum from the file
GetOrderNum = System.PrivateProfileString(sPath, "Settings", "OrderNum")
'if the ordernum key is missing or it is a new file then start at 1
If GetOrderNum = "" Then
GetOrderNum = "1"
End If
'Write the updated value back to the file
System.PrivateProfileString(sPath, "Settings", "OrderNum") =
CStr(CInt(GetOrderNum) + 1)
'Format the Order number with leading zeros
GetOrderNum = Format(GetOrderNum, "00000")
GetOrderNum = "DEL" & GetOrderNum
End Function
TIA
James