JoeB JoeB - 1 year ago 158 Question

Open Windows Explorer UnFocused

I am using

Process.Start("explorer.exe", "/select,""" & ExcelPath & """")
to open Windows Explorer and also select an Excel file. This always brings Explorer to the front\focused. I would like for explorer to open unfocused.

Is this possible?

Answer Source

Process.StartInfo.WindowStyle allows you to start the given window minimised or hidden. Sample code:

Dim curProcess As Process = New Process()
With curProcess
    With .StartInfo
        .FileName = "explorer.exe"
        .Arguments = "/select," & """" & ExcelPath & """"
        .WindowStyle = ProcessWindowStyle.Minimized 'ProcessWindowStyle.Hidden
    End With
End With
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download