Тема: Не работает код
Почему не работает код?
У меня работает у других нет.
Вот так: Option Explicit Private Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _ "SHGetPathFromIDListA" (ByVal pidl As Long, _ ByVal pszPath As String) As Long Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _ "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _ As Long Private Const BIF_RETURNONLYFSDIRS = &H1 Sub ConnectX() Dim MyPath As String, FName As String MyPath = GetFolder("Choose Folder") ' Выбор папки с файлами *.dwg FName = Dir(MyPath & "\*.dwg", vbNormal) ' Возвращает первый элемент. Do While FName <> "" ' Начинает цикл. Loop End Sub Public Function GetFolder(szDialogTitle As String) As String Dim X As Long, bi As BROWSEINFO, dwIList As Long Dim szPath As String, wPos As Integer With bi .lpszTitle = szDialogTitle .ulFlags = BIF_RETURNONLYFSDIRS End With dwIList = SHBrowseForFolder(bi) szPath = Space$(512) X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath) If X Then wPos = InStr(szPath, Chr(0)) GetFolder = Left$(szPath, wPos - 1) Else GetFolder = "" End If End Function