M
Mark
I am trying to setup some code which looks at a user group in an ini file and
if they're included the code lets them continue to open the template. The
below works fine on a local drive, but fails on a mapped network drive!
Can someone please assist me with a solution, please?
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Dim strUserName As String
Dim strPermittedUser As String
'Name and location of file containing permitted users man numbers
Public Const strPermittedUsersFile = "N:\PD\PSD Permissions.ini"
Sub IP3()
'Checks user is authorised to open document from template
strUserName = Environ("USERNAME")
strPermittedUser = System.PrivateProfileString(strPermittedUsersFile,
"PERMITTED", strUserName)
If strPermittedUser <> "YES" Then
MsgBox "You are not in the user group therefore" _
& vbCr & "you cannot use this template.", vbCritical, "Error"
Exit Sub
Else
Documents.Add Template:= _
"C:\Program Files\Microsoft Office\Templates\User
Templates\IP3.DOT", _
NewTemplate:=False
End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Many thanks
if they're included the code lets them continue to open the template. The
below works fine on a local drive, but fails on a mapped network drive!
Can someone please assist me with a solution, please?
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Dim strUserName As String
Dim strPermittedUser As String
'Name and location of file containing permitted users man numbers
Public Const strPermittedUsersFile = "N:\PD\PSD Permissions.ini"
Sub IP3()
'Checks user is authorised to open document from template
strUserName = Environ("USERNAME")
strPermittedUser = System.PrivateProfileString(strPermittedUsersFile,
"PERMITTED", strUserName)
If strPermittedUser <> "YES" Then
MsgBox "You are not in the user group therefore" _
& vbCr & "you cannot use this template.", vbCritical, "Error"
Exit Sub
Else
Documents.Add Template:= _
"C:\Program Files\Microsoft Office\Templates\User
Templates\IP3.DOT", _
NewTemplate:=False
End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Many thanks