Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

excel 2010 vba user form embed youtube video

Tags:

excel

vba

i'm trying to figure out a way to embed a video into a user form in Excel VBA, but the issue that im facing is that, according to some sites, that you need to add the "Shockwave Flash Object" control and use it to embed the youtube video into a user form, but I can't seem to find the Shockwave Flash Object in the additional controls list. Is there some reference that I need to add? Or is there an easier way to embed a youtube video into the user form?

like image 906
user974047 Avatar asked Feb 01 '26 21:02

user974047


1 Answers

Well I did find that control in the list and then it works just like that:

Private Sub CommandButton1_Click()
    With Me.ShockwaveFlash1
        .LoadMovie 0, "http://www.youtube.com/v/jmHkMsrycBw"
    End With
End Sub

But if you need an alternative, you can display an embedded object on a Webbrowser control ('Microsoft Web Browser' in the controls list).

Private Sub CommandButton2_Click()
  With WebBrowser1
        .Navigate2 "about:" & _
            "<body style=""margin:0px;padding:0px"">" & _
            "<object width=""100%"" height=""100%"" type=""application/x-shockwave-flash"" data=""http://www.youtube.com/v/jmHkMsrycBw&amp;hl=de&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;border=1"">" & _
            "<param name=""movie"" value=""http://www.youtube.com/v/jmHkMsrycBw&amp;hl=de&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;border=1"" />" & _
            "<param name=""allowFullScreen"" value=""true"" />" & _
            "</object></body>"
    End With
End Sub

More Info on embedding code:
https://developers.google.com/youtube/player_parameters

like image 166
KekuSemau Avatar answered Feb 04 '26 11:02

KekuSemau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!