• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

how to use inbuilt camera app to take picture and save it in excel sheet..

Nitesh Khot

Member
Hi ..,

I am looking vba code to capture picture from any inbuilt camera app and save picture to folder and in excel sheet ..


it is possible ....


Thanks in advance

Nikh
 
have gone thr this but getting error in below line

RetVal = Shell("ApplicationName " & "/preview /delay 5000", vbNormalFocus )

Code:
Option Explicit

Private Sub Capture_Photo()
    Dim RetVal As Variant
    Dim n As String
    Dim ImageName, ApplicationName, desktoppath As String
      
    ' Make sure the current directory is set to the one
    ' where the Excel file is saved
     desktoppath = Environ("UserProfile") & "\Desktop\New folder\"
     ChDir (desktoppath)
    n = InputBox("Enter Initial name for image", "Name for Image")
       
     ' Capture new image
     
    
     ImageName = "/filename " & desktoppath & n & Format(Now, "DDMMYYYY") & ".bmp"
     ApplicationName = desktoppath & "CommandCam" & " /filename" & ImageName

     RetVal = Shell("ApplicationName " & "/preview /delay 5000",  vbNormalFocus )

    ' Short delay to let new file finish saving
    Application.Wait (Now + TimeValue("00:00:01"))
End Sub
 
I cannot test this, but You could change that line:
Code:
RetVal = Shell(ApplicationName & " /preview /delay 5000", vbNormalFocus )
... after that ApplicationName could be as
Code:
ApplicationName = desktoppath & "CommandCam" & " /filename" & ImageName
 
Back
Top