A
aef1
Hi All,
Just created some macros in Word....They open up Word templates that
are located on a server. Each office has its own server with the same
filepath....The only difference is the server name.
Template location
Brighton office = \\br-fs-01\vbatemplates$\Templatename.dot
Oxford office = \\ox-fs-01\vbatemplates$\Templatename.dot
etc
The code to open up the Templates is contained in the Sub procedures. I
have tried creating a Public Sub procedure and calling the code in each
Sub routine, but it is not working...the code doesn't execute.
But it does work if I write the code out in each Sub procedure. The
code looks to Active Directory to find the user location and opens the
local server copy of the template:
Public Sub OpenLocalCopyOfTemplate()
Set objAdSys = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://servername.com/" & objAdSys.UserName)
objUser.GetInfoEx Array("property1", "Property2"), 0
If objUser.Get("PhysicalDeliveryOfficeName") = "Brighton" Then
strFileServer = "\\br-fs-01"
End If
If objUser.Get("PhysicalDeliveryOfficeName") = "Oxford" Then
strFileServer = "\\ox-fs-01"
End If
If objUser.Get("PhysicalDeliveryOfficeName") = "London" Then
strFileServer = "\\lo-fs-01"
End If
End Sub
Does anyone know where the code should be written or how to filter the
strFileServer variable through to the Sub procedures?
Many TIA,
Net
Just created some macros in Word....They open up Word templates that
are located on a server. Each office has its own server with the same
filepath....The only difference is the server name.
Template location
Brighton office = \\br-fs-01\vbatemplates$\Templatename.dot
Oxford office = \\ox-fs-01\vbatemplates$\Templatename.dot
etc
The code to open up the Templates is contained in the Sub procedures. I
have tried creating a Public Sub procedure and calling the code in each
Sub routine, but it is not working...the code doesn't execute.
But it does work if I write the code out in each Sub procedure. The
code looks to Active Directory to find the user location and opens the
local server copy of the template:
Public Sub OpenLocalCopyOfTemplate()
Set objAdSys = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://servername.com/" & objAdSys.UserName)
objUser.GetInfoEx Array("property1", "Property2"), 0
If objUser.Get("PhysicalDeliveryOfficeName") = "Brighton" Then
strFileServer = "\\br-fs-01"
End If
If objUser.Get("PhysicalDeliveryOfficeName") = "Oxford" Then
strFileServer = "\\ox-fs-01"
End If
If objUser.Get("PhysicalDeliveryOfficeName") = "London" Then
strFileServer = "\\lo-fs-01"
End If
End Sub
Does anyone know where the code should be written or how to filter the
strFileServer variable through to the Sub procedures?
Many TIA,
Net