Preston
Preston

Reputation: 8187

Shell Camera.exe from VBA Excel

Using the Shell command i'd like to open camera. However, when i try the below command, i get a pause of 3 seconds or so and the function ends (no error message) whithout opening the Microsoft Camera application. Why is this and how can i avoid the problem?

sub Main
    Shell("C:\Windows\Camera\Camera.exe", vbMaximisedFocus)
end sub

Had a look at the msdn page, but i couldn't get the diagnostics.process object to registed.

https://msdn.microsoft.com/en-us/library/xe736fyk(v=vs.90).aspx

Using Excel 13, I've tried multiple options for the second argument to no avail. Help appreciated.

Upvotes: 2

Views: 1463

Answers (1)

Rodger
Rodger

Reputation: 841

You need to call it. Try this.

Sub Main()
    Call Shell("C:\Windows\Camera\Camera.exe", vbMaximisedFocus)
End Sub

Upvotes: 2

Related Questions