Using Windows Media Player Control

MM91

Board Regular
Joined
Nov 29, 2021
Messages
59
Office Version
  1. 365
Platform
  1. Windows
Hello I am trying to use the activex windows media player control "IntroVideo" on workhsheet "Standards" but I keep getting "method or data member not found" I have verified all the names are corroct. Does anyone have any ideas?

Option Explicit
Dim ws As Worksheet
Dim wb As Workbook

Private Sub Workbook_Open()


'MsgBox "Welcome"
Set wb = ActiveWorkbook
Set ws = wb.Worksheets("Standards")


With ws.Introvideo 'Windowsmediaplayercontrol
.StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.Show
.Play
End With


End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
On what line does the code break and that error message appear?
Your code reads like it should be on a Userform and not on the worksheet because ".StartupPosition" is not a method or a data member of the WMP control. And you wouldn't position a control on a worksheet by reference to the Application object. And now that I think of it, I don't think that .Show is a method of the WMP Control either.
 
Upvote 0
Solution
On what line does the code break and that error message appear?
Your code reads like it should be on a Userform and not on the worksheet because ".StartupPosition" is not a method or a data member of the WMP control. And you wouldn't position a control on a worksheet by reference to the Application object. And now that I think of it, I don't think that .Show is a method of the WMP Control either.
Ah thank I moved it into my userform and modified it slightly getting of .startupposition and .show instead referenced .left and .top and visible and it worked
 
Upvote 0
Fantastic! I got the notification to say you had marked as the solution, I'm thinking "But I didn't offer a solution..." :ROFLMAO:
I guess I accidentally did - thank you very much! TBH I didn't think you could run the WMP control in the worksheet anymore, and that it had been deprecated like the webbrowser control had. I had just been trying it out now. Thanks for the tip!!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top