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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,214,787
Messages
6,121,569
Members
449,038
Latest member
Guest1337

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