ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileServer with GetOpenFilename (https://www.excelbanter.com/excel-programming/303890-fileserver-getopenfilename.html)

Philipp Oberleitner

FileServer with GetOpenFilename
 
Here my code :

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


Is it possible to use a Fileserver instead of a drive letter ? If not how
can i integrate so he can open directories on FileServer ?

Thanks alot in advance



Rob Bovey

FileServer with GetOpenFilename
 
Hi Philipp,

You can use the SetCurrentDirectoryAPI to set the current directory to
a UNC path. Here's a quick procedure that will do this:

Private Declare Function GetCurrentDirectoryA Lib "kernel32" _
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long

Public Sub SetUNCPath(ByVal szPathToSet As String)
SetCurrentDirectoryA szPathToSet
End Sub

Despite the name, it works on regular drive\path strings as well.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Philipp Oberleitner" wrote in message
...
Here my code :

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


Is it possible to use a Fileserver instead of a drive letter ? If not how
can i integrate so he can open directories on FileServer ?

Thanks alot in advance






All times are GMT +1. The time now is 09:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com