VBA sub to launch external app/program

RobbieC

Active Member
Joined
Dec 14, 2016
Messages
376
Office Version
  1. 2010
Platform
  1. Windows
Hi there, I have a macro (AddNewPhoto) which allows me to select a photo and put it into my spreadsheet. The macro is triggered from a button on a userform.

I have also got a macro which will launch the camera on my tablet:

Code:
Sub launchCamera()
Dim MyFile As String
Dim Cmd As String
MyFile = "C:\Users\User\Desktop\Camera.lnk"
Cmd = "RunDLL32.EXE shell32.dll,ShellExec_RunDLL "
Shell (Cmd & MyFile)
End Sub

this works by launching the app/program from a link on the desktop

My question is:

Am I able to run my 'AddNewPhoto' macro and call my 'launchCamera' sub at the start, but pause the rest of the my macro until I have finished taking the photo (in the camera app)

I don't know if I've explained myself properly, but I'm basically looking to pause Excel whist another program is onFocus and then resume when Excel is back onFocus....

If you can help me throw some light on this, I'd be very grateful

Thanks
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top