Have you ever tried to play a video file from a worksheet? In this article, I will talk about some interesting tricks for you to play a video file which is stored in your computer from an Excel workbook.
Play a video file from worksheet by setting the properties of Windows Media Player
Play a video file from worksheet by clicking a Command Button
Play a video file from worksheet by setting the properties of Windows Media Player
In Excel, there is a useful control - Windows Media Play can help you to play a video file, please do as follows:
1. Click Developer > Insert > More Controls, see screenshot:
2. In the More Controls dialog box, scroll and select Windows Media Player option, then click OK button to close the dialog, and then drag the mouse to draw a Windows Media Play object, see screenshot:
3. Then go to the Properties dialog by clicking Developer > Properties, in the Properties dialog, please do the following operations:
(1.) In the Alphabetic tab, please select True option from the fullScreen field;
(2.) Copy and paste your video file path which should include the file extension into the URL field.
4. After finishing the above settings, please exit Design mode, and, your specified video is playing now.
Play a video file from worksheet by clicking a Command Button
If you want to play a video file with a command button, when you click the command button, a browse window will pop out to let you choose the video file to play. The following steps may help you:
1. According to the step 1-2 in method 1 to insert the Windows Media Player control, and then go on clicking the Developer > Insert > Command Button to insert a Command Button, see screenshot:
2. Then right click the Command Button, and choose Properties from the context menu, in the popped out Properties dialog box, type the text Play Video beside the Caption field under Alphabetictab, see screenshot:
3. And then close the Properties dialog, then double click the Command Button, and then copy and paste the following VBA code to replace the original code into the Microsoft Visual Basic for Applications window.
VBA code: Play a video file from worksheet:
1
2
3
4
5
6
7 |
Private Sub CommandButton1_Click()
Dim FName As Variant
FName = Application.GetOpenFilename(FileFilter:="Video Files, *.mp4; *.avi; *.mpeg; *.mts", Title:="Please select a Video File", MultiSelect:=False)
If FName <> False Then
WindowsMediaPlayer1.Url = FName
End If
End Sub
|
Note: In the above code, CommandButton1 is the command button name you inserted, and the WindowsMediaPlayer1 is the Windows Media Player name you have inserted. And you can add other video file extensions as you need into the *.mp4; *.avi; *.mpeg; *.mts script.
4. Then save and close the code window, and exit the Design mode, now, when you click the Command Button, a browse window will appear to remind you select the video file you want to play, then click Open button, the specific video file will be played at once. See screenshot:
Src: https://www.extendoffice.com/documents/excel/4483-excel-play-video.html
Convert All Videos to MP4 for Excel worksheet
The video format you can embed into Excel Worksheet is limited. Sometimes, you need a Video Converter to transcode the video format to compatible with Excel worksheet and WMP. Pavtube Video Converter Ultimate is an excellent video transcode that can convert any video to WMV, MP4, MKV, AVI, etc. It even can convert Blu-ray and DVD to Excel worhsheet and WMP playable video format. If you only need to add audio to excel worksheet, you also can use the application to convert video to audio. The equivalent Mac version is Pavtube iMedia Converter for Mac which is compatible with macOS Sierra.
Related Articles:
Among all MP4 to Panasonic TV converters, Avdshare Video Converter is highly recommended by most users.https://www.avdshare.com/how-to-play-mp4-on-panasonic-tv
ReplyDelete