1

I'm trying to create an excel vba program/macro that will start a movie stored locally on my hard-drive in vlc player using the vlc activex plug-in (axvlc.dll). I'm able to register vlc so it appears in my Project References. I'm also able to see AXVLC in the "Object Browser". But I can't get any code to work that doesn't give "Run-time error '429': ActiveX component can't create." I'm using Excel 2016 and VBA 7.1.

Sub Button1_Click()
   Dim myVlC As Object
   Set myVlC = CreateObject("AXVLC.VLCPlugin2")
   myVlC.Visible = True
   myVlC.playlist.Add ("test.mkv")
   myVlC.playlist.Play
End Sub

I tried to follow the conversation here... Using VLC player activex within excel vba as a registration-free COM and here... https://social.msdn.microsoft.com/Forums/en-US/baec16d1-e85c-4be9-8751-966bef527756/vlc-player-and-excel-visual-basic-editor?forum=isvvba with no success.

I've created a lot of simple macros, but never anything using ActiveX, or anything really this object oriented before. Any help will be greatly appreciated.

Community
  • 1
  • 1
Mike
  • 13
  • 2
  • 4
  • after you registered it, did you add it? – ashleedawg Apr 10 '18 at 19:52
  • Sorry, I'm not sure what that means - "did you add it?". When I click Tools->References I see VideoLAN VLC ActiveX Plug-in in my list. Is there another step I'm missing? – Mike Apr 10 '18 at 19:57
  • 1
    Oh, I did check the box! If that's what you mean. – Mike Apr 10 '18 at 19:58
  • In that link someone said if you're using late-binding you should be using `VideoLAN.VLCPlugin.2` instead of `AXVLC.VLCPlugin2`, but they also say that you can't use late-binding at all with this plugin (aka `CreateObject()`), so I'm not sure what the right answer here is. – dwirony Apr 10 '18 at 20:19
  • aha - it just came to me where I had seen working code for VLC+VBA... It was *my* post (lol), over on AWF. **[Does this help](https://access-programmers.co.uk/forums/showpost.php?p=1537834&postcount=2)** at all? The post was re: Access but should be pretty close. (Ha, funny reading stuff from "past me", referring to *"The"* StackOverflow [Page](https://stackoverflow.com/questions/32003530/vlc-playing-embedded-in-ms-access-2013); that very post could possibly be what got me started on *this* site.) – ashleedawg Apr 10 '18 at 20:53
  • I tried VideoLAN.VLCPlugin.2 - I get "user defined type not defined". – Mike Apr 10 '18 at 21:17
  • Rats. I wish your post helped... but still nothing. I get the error creating the object... Set myVlC = New AXVLC.VLCPlugin2 – Mike Apr 10 '18 at 21:32

1 Answers1

1
Public Sub Start_VLC()
'its working for me...
    Dim strProgramName As String
    Dim strArgument As String
    Dim strLoc As String

    strLoc = Worksheets("dbFilmes").Cells(2, 6).Value 'film location
    strProgramName = "C:\Program Files\VideoLAN\VLC\vlc.exe" 'vlc location
    strArgument = strLoc 'film location

    Call Shell("""" & strProgramName & """ """ & strArgument & """", vbNormalFocus)
End Sub
Ankit Bajpai
  • 13,128
  • 4
  • 25
  • 40
jrola
  • 11
  • 1