none
VB to take a photo? RRS feed

  • Question

  • I'm putting a security question on a  spreadsheet- if someone gets it wrong is it possible to use the camera (if one exists) on the computer to take and email a photo of who tried to get in?

    Just wondering!

    Thanks

    David

    Wednesday, February 10, 2016 10:00 AM

Answers

  • There is a great utility called commandcam (you need to have admin rights to install it) that works great with Excel.  Here are the instructions for using it

    https://batchloaf.wordpress.com/2013/01/07/running-commandcam-from-excel-using-vba/

    Emailing depends on what else is on the computer - do you have Outlook? Or Gmail?


    Wednesday, February 10, 2016 6:04 PM
  • Here's my file - it needs to go into the same folder as the exe file. It includes macros to take a series of pictures and to display them (I use it to monitor tests where there is a visual change that takes a while to appear).

    http://1drv.ms/1WuBL8o

    • Marked as answer by David_1234 Friday, February 19, 2016 9:40 AM
    Thursday, February 18, 2016 10:18 PM

All replies

  • There is a great utility called commandcam (you need to have admin rights to install it) that works great with Excel.  Here are the instructions for using it

    https://batchloaf.wordpress.com/2013/01/07/running-commandcam-from-excel-using-vba/

    Emailing depends on what else is on the computer - do you have Outlook? Or Gmail?


    Wednesday, February 10, 2016 6:04 PM
  • >>>I'm putting a security question on a  spreadsheet- if someone gets it wrong is it possible to use the camera (if one exists) on the computer to take and email a photo of who tried to get in?

    According to your description, I suggest that you could use the Camera tool to capture dynamic pictures of different parts of your worksheet then create a email, refer to below code:

    Sub Demo()
    
        Dim UserRange As Range
        
        Set oOlApp = CreateObject("Outlook.Application")
        
        Set oOlMItem = oOlApp.CreateItem(olMailItem)
        
        Application.ScreenUpdating = True
        
        'Prompt user for range to capture
        MyPrompt = "Select the range you would like to capture."
        MyTitle = "User Input Required"
        On Error Resume Next
        Set UserRange = Application.InputBox(Prompt:=MyPrompt, _
           Title:=MyTitle, Default:=ActiveCell.Address, Type:=8)
        If UserRange Is Nothing Then End
        On Error GoTo 0
        
        'Copy range to Clipboard as picture
        UserRange.CopyPicture
        
        With oOlMItem
        
         .To = "email@email.com"
         .Subject = "Subject"
        
         Set oOlInsp = .GetInspector
         Set oWdDoc = oOlInsp.WordEditor ' get Word Document from the MailBody
        
         Set oWdContent = oWdDoc.Content
         oWdContent.InsertParagraphBefore
         Set oWdRng = oWdDoc.Paragraphs(1).Range
         oWdRng.InsertBefore "This is a test"
         oWdRng.InsertParagraphAfter
         oWdRng.InsertParagraphAfter
        
         Set oWdRng = oWdDoc.Paragraphs(3).Range
         oWdRng.Paste ' paste from Clipboard
        
         .Display
        
        End With
    End Sub
    

    Thursday, February 11, 2016 3:02 AM
  • Bernie

    That's great- thanks for that- when I run it the DOS screen pops up- is there a way to prevent this so person doesn't know something as done?- I tried Applications.screenupdating false but didn't work

    Thansk

    David

    Friday, February 12, 2016 3:42 PM
  • I don't get the DOS screen, so give this code a try.

     RetVal = Shell("CommandCam.exe", vbHide)

    If you need it, I can upload my workbook with the code.

    Friday, February 12, 2016 7:14 PM
  • Bernie

    Sorry for not replying but I never got notification that you had replied.

    If you could upload you workbook that would be great as I still get the dos screen coming up

    Thanks again

    David

    Thursday, February 18, 2016 3:20 PM
  • Here's my file - it needs to go into the same folder as the exe file. It includes macros to take a series of pictures and to display them (I use it to monitor tests where there is a visual change that takes a while to appear).

    http://1drv.ms/1WuBL8o

    • Marked as answer by David_1234 Friday, February 19, 2016 9:40 AM
    Thursday, February 18, 2016 10:18 PM
  • Bernie

    As ever thanks a million

    D

    Friday, February 19, 2016 9:40 AM
  • Ok I'm not the most advanced at computers so please in lames terms

    Thursday, April 5, 2018 9:56 PM