Home Open Explorer Maximized with Focus and Highlight File from Access VBA
Reply: 0

Open Explorer Maximized with Focus and Highlight File from Access VBA

user957
1#
user957 Published in April 21, 2018, 3:34 pm

I am trying to open Windows Explorer and highlight a file.

I am using:

Private Sub cmdLoadStl_Click()
Dim shellCmd As String
shellCmd = "explorer.exe /select, """ & Me.txtPath & """,vbMaximizedFocus"
Debug.Print shellCmd
Shell (shellCmd)
End Sub

This works as expected except the window opens minimized.

I have tried this on several Win7 machines running Access 2016 and two Win10 machines, one running Access 2013, the other running Access 2016.

Is there any way to get the window to open maximized?

Edit: More information - If I paste the command generated by debug.print in my code to a command prompt and run it, the explorer window opens maximized, with the file highlighted, as it should.

The command generated from vba looks like this.

explorer.exe /select, "C:\Users\user\Desktop\filename.txt",vbMaximized

Thanks.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310401 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO