Skip to content

Instantly share code, notes, and snippets.

@ba5tz
Created January 22, 2022 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ba5tz/563c7da8593bc82967143c41e956da7d to your computer and use it in GitHub Desktop.
Save ba5tz/563c7da8593bc82967143c41e956da7d to your computer and use it in GitHub Desktop.
VBA Webcam
' WebCam VBA by Andi Setiadi
' Blog [ setiadi.my.id | arrayformula.com ]
Sub Webcam()
Const FileCam As String = "image.bmp"
Const ModCam As String = "CommandCam.exe"
ChDir ThisWorkbook.Path
If Dir(FileCam) > "" Then Kill (FileCam)
Shell ModCam, vbHide
While Dir(FileCam) = ""
when
Application.Wait (Now + TimeValue("00:00:01"))
Image1.Picture = LoadPicture(FileCam)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment