Private Sub subListFolders(ByVal strFolders As String, intCounter As Integer) Private Function fnCompareCriteriaWithFolderName(strFolderName As String, strCriteria As String) As BooleanįnCompareCriteriaWithFolderName = InStr(1, Replace(strFolderName, " ", "", 1,, vbTextCompare), Replace(strCriteria, " ", "", 1,, vbTextCompare), vbTextCompare) > 0 Shell "EXPLORER.EXE" & " " & Chr(34) & subfldrInStart.Path & Chr(34), vbNormalFocusĬall fnFindFoldersWithCriteria(subfldrInStart, strCriteria, intCounter) ' Debug.Print "Found and Opening: " & subfldrInStart.Name & "Because of: " & strCriteria If fnCompareCriteriaWithFolderName(subfldrInStart.Name, strCriteria) Then Shell "EXPLORER.EXE" & " " & Chr(34) & fldrStartFolder.Path & Chr(34), vbNormalFocusįor Each subfldrInStart In fldrStartFolder.SubFoldersĭebug.Print "Criteria: " & Replace(strCriteria, " ", "", 1,, vbTextCompare) & " and Folder Name is " & Replace(subfldrInStart.Name, " ", "", 1,, vbTextCompare) & " and Path is: " & fldrStartFolder.Path ' Debug.Print "Found and Opening: " & fldrStartFolder.Name & "Because of: " & strCriteria If fnCompareCriteriaWithFolderName(fldrStartFolder.Name, strCriteria) Then ' Debug.Print "Criteria: " & Replace(strCriteria, " ", "", 1,, vbTextCompare) & " and Folder Name is " & Replace(fldrStartFolder.Name, " ", "", 1,, vbTextCompare) & " and Path is: " & fldrStartFolder.Path Set fldrStartFolder = fso.GetFolder(strStartPath) Private Function fnFindFoldersWithCriteria(ByVal strStartPath As String, ByVal strCriteria As String, intCounter As Integer) VarCriteria = Array(Nz(Me.txtSerial, "Null"), Nz(Me.txtCustomerOrder, "Null"), Nz(Me.txtAXProject, "Null"), Nz(Me.txtWorkOrder, "Null"))Ĭall fnFindFoldersWithCriteria(TrailingSlash(Me.txtStartPath), strCriteria, 1) Set inputFileDialog = Application.FileDialog(msoFileDialogFolderPicker) If MsgBox("Clear List?", vbYesNo, "Clear List") = vbYes Then DoCmd.RunSQL "DELETE * FROM tblFileList"
#How to access solidworks toolbox browser code
Here is the whole code on the form: Option Compare Database While doing work on finding a solution I created a small database that asks for a search starting folder gives a place for 4 pieces of criteria and then allows the user to do criteria matching that opens the 4 (or more) possible folders that match the entered criteria. I had a situation where I needed to be able to find folders based on a bit of criteria in the record and then open the folder(s) that were found. Here is some more cool knowledge to go with this: (Or overrides it? I don't know what the technical details are and I'm curious to know exactly what the chain of events is here.) However by specifying the /max or /min flag when calling 'start' it prevents the vbAppWinStyle set on the CMD window from being applied recursively. (So luckily we can use this to un-hide our ghost-window by calling the same command again with a different vbAppWinStyle argument.) In other words when the 'start'-command finds an existing window the specified vbAppWinStyle gets applied to both the CMD-window and the reused explorer window. unless there is already such a folder opened, in which case the existing folder window becomes hidden and disappears! You now have a ghost window floating around in memory and any subsequent attempt to open the folder after that will reuse the hidden window - seemingly having no effect.
Relatively simple (does not need to reference win32 libraries).
Where 'path' is the folder you want to open. Shell "cmd /C start """" /max """ & path & """", vbHide
#How to access solidworks toolbox browser windows
Thanks to PhilHibbs comment (on VBwhatnow's answer) I was finally able to find a solution that both reuses existing windows and avoids flashing a CMD-window at the user: Dim path As String