How to Play Video File from Excel Worksheet?


Ever ponder whether you might easily incorporate video playback into your Excel spreadsheets? The good news is that it is in fact feasible, and in this lesson, we'll examine the detailed steps involved in carrying it out. Excel's ability to play videos can be beneficial for a number of tasks, including the creation of interactive presentations, training materials, or simply adding a visual component to your spreadsheet. You may embed a video file into your Excel worksheet and enable playback right within the spreadsheet by following the instructions in this article.

This tutorial will provide you the skills and resources you need to successfully include movies into your spreadsheets, whether you're a business professional, a teacher, or just someone trying to improve your Excel skills. So, let's get going and explore the intriguing potential of Excel's video playback!

Play Video File from Excel Worksheet

Here we will first insert a command button and then add a macro to the button to complete the task. So let us see a simple process to know how you can play a video file from an Excel worksheet.

Step 1

Consider any Excel sheet. First, click on developer, then click on insert, and select the command button under ActiveX controls.

Developer > Insert > Button.

Step 2

Then draw a command button. Then right-click on the button and select View Code to open the VBA application. Then copy the below code into the text box.

Draw > Right Click > View Code > Copy.

Code

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

Step 3

Then close VBA using Alt + Q and exit the Design mode. From now on, when you click on the button, a browse window to select videos will be opened.

This is how you can play a video file from an Excel worksheet.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can play a video file from an Excel worksheet to highlight a particular set of data.

Updated on: 06-Sep-2023

96 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements