Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Browse for folder
In Jim Rech's code for "Browse for Folder", he idicates that we can
establish our own initial folder. If I use a folder that is located on a newwork and give it the full path \\ MyNetwok\MyFolder \ it does not seem to work in the old SHELL32.dll format. For it to work I have to map the drive. This means that ALL the computers in our office need to be maped!!! We don't use the new format of the SHELL32.dll because it doesn't show the file unless you expend the tree (unless I don't know how to do it right!). Unlike the old format, you get the files right a way without having to expend the tree anymore. We use Office XP on WindowsXP both with the latest updates. How can I avoid maping with a drive letter and use the old format.... or use the new format but show the files included in that folder right a way. Regards, Michel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Browse for folder
Well done Jim. Thank you for your tip
Regards, Michel "Jim Rech" a écrit dans le message de ... it does not seem to work in the old SHELL32.dll format. I'll take your word for it that old Shell functions do not support UNC paths. This means that ALL the computers in our office need to be maped!!! Not necessarily. Have you considered a temporary mapping? See Sub Demo below. Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" _ (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" _ (ByVal lpszName As String, ByVal bForce As Long) As Long Declare Function WNetGetConnection Lib "mpr.dll" _ Alias "WNetGetConnectionA" (ByVal lpszLocalName As String, _ ByVal lpszRemoteName As String, cbRemoteName As Long) As Long Declare Function GetDriveTypeA Lib "KERNEL32" _ (ByVal DriveNumber As String) As Integer Sub Demo() Dim TempMap As String TempMap = GetAvailDriveLtr If TempMap < "" Then Connect TempMap & ":", "\\PMA0010F09\SYS1" MsgBox TempMap & " is available" ''Do Browse using TempMap DisConnect TempMap & ":" End If End Sub Function GetAvailDriveLtr() As String Dim DrvCtr As Integer, DrvType As Integer For DrvCtr = Asc("C") To Asc("Z") DrvType = GetDriveTypeA(Chr(DrvCtr) & ":\") If DrvType < 0 And DrvType < 2 Then GetAvailDriveLtr = Chr(DrvCtr) Exit Function End If Next End Function Sub Connect(sDrive, sService As String) On Error GoTo Err_Connect WNetAddConnection sService & Chr(0), "" & Chr(0), sDrive & Chr(0) Err_Connect: End Sub Sub DisConnect(sDrive As String) On Error GoTo Err_DisConnect WNetCancelConnection sDrive + Chr(0), 0 Err_DisConnect: End Sub -- Jim Rech Excel MVP |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
Browse button on form for folder path | Excel Discussion (Misc queries) | |||
Browse For Folder start directory | Excel Programming | |||
Designate a folder as the root of the Browse tree | Excel Programming |