![microsoft excel 2011 open vba window windows microsoft excel 2011 open vba window windows](https://www.digicert.com/kb/images/code-signing/microsoft-office-vba5.jpg)
- #Microsoft excel 2011 open vba window windows code
- #Microsoft excel 2011 open vba window windows windows
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"
#Microsoft excel 2011 open vba window windows 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.
![microsoft excel 2011 open vba window windows microsoft excel 2011 open vba window windows](https://www.techonthenet.com/excel/macros/images/visual_basic_editor2010_001.gif)
(In this example I open the folder where the current workbook is saved.)
![microsoft excel 2011 open vba window windows microsoft excel 2011 open vba window windows](https://www.techonthenet.com/excel/macros/images/visual_basic_editor2016_002.png)
Where 'path' is the folder you want to open. Shell "cmd /C start """" /max """ & path & """", vbHide
#Microsoft excel 2011 open vba window windows 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