@cadguy wrote:
I’m using this to open a folder window. But if the window is already open and I want to bring it to the front not open a nether window.
Sub folder_profiles() 'file = "Profiles" Const FOLDER = "\Jewelerscad\Profiles\" Dim objShell, strFolder, file Set objShell = CreateObject("WScript.Shell") strFolder = objShell.SpecialFolders("MyDocuments") strFolder = strFolder & FOLDER 'MsgBox strFolder Call OpenFolder(strFolder) End Sub Sub OpenFolder(strFolder) Const COMMAND = "Explorer.exe / e," Dim objFSO, objShell, strError, strCommand Set objFSO = CreateObject("Scripting.FileSystemObject") If Not objFSO.FolderExists(strFolder) Then strError = "Folder not found - " & strFolder Call MsgBox(strError, vbOKOnly + vbCritical, "Open Folder") Exit Sub End If Set objShell = CreateObject("WScript.Shell") strCommand = COMMAND & strFolder Call objShell.Run(strCommand) End Sub
Posts: 1
Participants: 1