Solved

embed video into excel

Posted on 2014-02-04
3
1,214 Views
Last Modified: 2014-02-26
Hi,

I know how to embed a ms video player and get it to play a video.  However, what I would like to do, is once button is clicked it brings up file browser to select video to be played.

Also, has control buttons for play pause, and when MARK is clicked it starts a timer until its clicked again and the places the values into a sell, and repeats process if required.

Also, the video box currently shoots to size of video, I would like to be able to force this to a defined size.

How to do this?
0
Comment
Question by:DemonForce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39838561
You've actually asked several questions here:
1. How to code a sub-procedure that will browse for a media file and then play the selected file in a WindowsMediaPlayer ActiveX control.
2. How to create a timer in vba and write result to cell.
3. How to force a WindowsMediaPlayer ActiveX control to retain its size regardless of the video size.

As for the answers:

1. Add a command button to your sheet, add the following code to the click event:
Private Sub CommandButton1_Click()
    Dim FName As Variant
    FName = Application.GetOpenFilename(FileFilter:="Video Files, *.mp4; *.avi; *.mpeg", Title:="Select a Video File", MultiSelect:=False)
    If FName <> False Then
        WindowsMediaPlayer1.URL = FName
    End If
End Sub

Open in new window

where WindowsMediaPlayer1 is the name of the control

3. To pre determine the size of the control you can add code like this:
Private Sub CommandButton1_Click()
    Dim FName As Variant
    FName = Application.GetOpenFilename(FileFilter:="Video Files, *.mp4; *.avi; *.mpeg", Title:="Select a Video File", MultiSelect:=False)
    If FName <> False Then
        With WindowsMediaPlayer1
            .Width = 120
            .Height = 120
            .Left = 10
            .Top = 10
            .URL = FName
        End With
    End If
End Sub

Open in new window


As far as your second question goes, it is unrelated to the first one, and should be asked in a separate question.
0
 

Author Comment

by:DemonForce
ID: 39844115
Hi

Thanks, seem to be getting an error with code, have inserted wma player and references are correct, but not seem to like anything in the with statement
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39844297
WindowsMediaPlayer1 is the name of your wmp control, if yours is named differently, change it accordingly.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question