Excel Macro to Capture Live Webcam Image?

I am attempting to write a macro which will access my USB connected camera, grab a picture, and paste it into an active cell.

I am able to do this manually by simply locating the cursor at a cell location, selecting "Insert - Picture - From Scanner or Camera", Selecting the Twain resource for my camera, Selecting Custom Insert, Selecting Take Picture... and viola, the active view from the webcam is placed into a cell

I don't expect a macro to do all of this, however, I would like to create a simple keystroke macro that will just bring up the Twain dialog box which has the "Take Picture" button displayed.

I have been toying around with the VB objects in the WIA library, but have not yet been able to successfully pull this stunt off.

Ideas Thanks.

Denis



Answer this question

Excel Macro to Capture Live Webcam Image?

  • RoryM

    Andy,

    Thanks again - it works sweet, once I took a closer look at what I was doing!
    It was me going "One-Delta-Ten-Tango" on the whole thing... Forgot the colon " : " in my code!

    Again, I really appreciate all of your prompt responses!


  • Reza Bemanian

    will this work in access i get the same runtime 91, i want to have a command button to open the capture window then have it save to a picture box or something.
  • GOH Omnipuff

    No references required.

    Which version of xl are you using. I tested in xl2003.


  • Rajesh batchu

    Glad you managed to work through it.


  • kirank_gh

    Hi Denis, I hope this is not a cheeky question, but I was trying to do exactly the same but not getting anywhere. I saw the helpful reply, but I am also not that good to be able to write my own macros.

    Did you get your sheet working and, if so, would I be able to have a look at how you did it

    I really appreciate your help

    Jo Turner


  • Mr.Analogy

    Is there a menu item that allows you to bring up the dialog manually



  • General Fault

    Hi,

    This should bring up the dialog.

    application.CommandBars.FindControl(Id:=1764).execute






  • encoded

    Thanks for your quick reply :)

    I am now getting a Run Time Error '91: Object variable or With block variable not set
    What Object did I forget I thought I had selected everyhting needed under my References.

    I know I am no wizard, and have limited macro programming knowledge - so bear with me... What am I missing

    Thanks a bunch!


  • Excel Macro to Capture Live Webcam Image?