Shell Picture Viewer Command Opens Minimized

Pienuts

Registered User.
Local time
Yesterday, 22:15
Joined
May 2, 2014
Messages
106
Hi all, I'm having trouble with a shell() command in my vba.

I'm trying to call up the picture viewer showing the file of the photo I clicked on in a form. Everything is happening as expected - the file opens in Windows Photo Viewer, but it is minimized.

I can open a picture fine from Windows Explorer, but something about my shell command is forcing a minimize.

Here is my code:
Code:
Dim sFile As String
 
PicFile = "C:\Pics\" & Me!PicName & ".jpg"
 
Shell "RunDLL32.exe C:\Windows\System32\Shimgvw.dll,ImageView_Fullscreen " & PicFile

I would have assumed ImageView_Fullscreen would do what I want!

Any help is appreciated - thanks for looking!
 
Hi I had the opposite problem, I need to minimize cmd so I did
Dim wsh As Object
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 2
Set wsh = VBA.CreateObject("WScript.Shell")
wsh.Run "MY cmd file", windowStyle, waitOnReturn
not suse if work for jpg, try to change 2 to 1 if work
 
That worked leanpilar! I had to remove the waitOnReturn and it worked like a charm with windowstyle = 2!

Thanks for your help!
 
Glad to help you, but it's strange, with windowstyle 2 it's minimized in my code :D
 

Users who are viewing this thread

Back
Top Bottom