Problem definition
I have two usb microscope reading part and serial numbers. I want to control the display and recording of screen shots from Excel-VBA.
I would like to try this using the supplied VLC active X component. I need the finish product to be a single zip that does not need to be installed. I think using this activex object as a registration-free COM is the way to go.
References
I have been doing my homework, here are my references.
How to use vlc.dll without registration?
VLC Player and Excel Visual Basic Editor
Cannot get registration-free COM working from VBA
My attempt so far.
I created Desktop\excel vlc demo\excel vlc demo.xlsb I then copied the entire vlc distribution to Desktop\excel vlc demo\vlc\
This includes axvlc.dll and axvlc.dll.manifest
I created a module and put this code in.
Sub VLC()
Dim actCtx As Object
Set actCtx = CreateObject("Microsoft.Windows.ActCtx")
actCtx.Manifest = ThisWorkbook.Path & "\vlc\axvlc.dll.manifest"
Dim myVlC As Object
Set myVlC = actCtx.CreateObject("AXVLC.VLCPlugin2")
myVlC.Visible = True
myVlC.playlist.Add (ThisWorkbook.Path & "\demo.mov")
myVlC.playlist.Play
End Sub
This fails at the line
Set myVlC = actCtx.CreateObject("AXVLC.VLCPlugin2")
with error
Run-time error '429':
ActiveX component can't create object
It is possible I have the wrong object name "AXVLC.VLCPlugin2", I could not confirm if it is still valid in the documentation.
It could also be that "user1610015" is correct in saying that "I don't think you can make reg-free COM work in this case"
At this point I am out of ideas, I never tried reg-free COM before so I don't know if I'm doing something wrong with the reg-free COM or the axvlc part !
thanks
EDIT 1: Attempt with early binding
I went in tool -> references, then clicked browse and added the axvlc.dll file. I modified the code as follows (the AXVLC.VLCPlugin2 part auto-completed so at least this part should work)
Sub VLC()
Dim myVlC As New AXVLC.VLCPlugin2
myVlC.Visible = True
myVlC.playlist.Add (ThisWorkbook.Path & "\demo.mov")
myVlC.playlist.Play
End Sub
However this fails with the same error
Run-time error '429':
ActiveX component can't create object
on the line
myVlC.Visible = True
Perhaps I also need to register this file with regsrv32 ? EDIT 2: tried regsvr32
ran this command from the vlc subfolder
regsvr32 axvlc.dll
I got a msgbox saying this command ran successfully, however I get the same error.