GetOpenFileName with network

  • Thread starter Thread starter Philipp Oberleitner
  • Start date Start date
P

Philipp Oberleitner

Hi atm im using a local version of GetOpenFilename but not everyone on the
network has theis network drive mapped on D:\

Public fName As String
Sub Auto_Open()
'ChDrive "C:\"
ChDir "\\MCHH227A\FS000458\TS B\TS B 2 (MD MM pWLAN
SAM)\IntegrationProjects\# Templates\ServiceBlueprints\SLA Violation Radar"
fName = Application.GetOpenFilename
MsgBox fName
End Sub


If i use a code like this i get an error.

Thanks alot in advance
 
Hi Philipp

change

....SLA Violation Radar"

to

....SLA Violation Radar\"


-----Original Message-----
Hi atm im using a local version of GetOpenFilename but not everyone on the
network has theis network drive mapped on D:\

Public fName As String
Sub Auto_Open()
'ChDrive "C:\"
ChDir "\\MCHH227A\FS000458\TS B\TS B 2 (MD MM pWLAN
SAM)\IntegrationProjects\#
Templates\ServiceBlueprints\SLA Violation Radar"
 
here's a post from Rob Bovey/Tom Ogilvy:

========

Private Declare Function SetCurrentDirectoryA Lib _
"kernel32" (ByVal lpPathName As String) As Long

Sub ChDirNet(szPath As String)
Dim lReturn As Long
lReturn = SetCurrentDirectoryA(szPath)
If lReturn = 0 Then Err.Raise vbObjectError + 1, "Error setting path."
End Sub

Example of usage

Sub GetFile()
On Error GoTo ErrHandler
ChDirNet "\\LOGD0FILES\OGILVTW\Docs\Temp"
Exit sub
ErrHandler:
MsgBox "Couldn't set path"
End Sub

Use like ChDir and ChDrive combined.
 
Back
Top