+ Reply to Thread
Results 1 to 7 of 7

Cmd Button Code to Display Video in Windows Media Player Object in Spreadsheet

  1. #1
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Cmd Button Code to Display Video in Windows Media Player Object in Spreadsheet

    Hi All,

    I have a sample spreadsheet (uploaded to this thread) in which I have 10 command buttons named 'Video 1' to 'Video 10'. Next to these buttons is a Windows Media Player Object.
    I require the code that upon clicking any of the video command buttons, the relevant video is opened and shown in the windows media object within the same sheet (sheet1).

    I'm sure the code for each button will be the same apart from the cmd button reference number/name and the link to the file to be played.

    If we assume all the videos are called as per their buttons i.e. Video 1.wmv, Video 2.wmv ... Video 10.wmv; and the location of these files is under 'C:\Films', can someone post up some code for button 'Video 1' making it clear which variables to change for linking to the different files.

    Thanks in advance - I'm sure this is no doubt very simple for you guys!

    Cheers!
    Attached Files Attached Files
    Last edited by VBA Noob; 04-22-2009 at 08:20 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Cmd Button Code to Display Video in Windows Media Player Object in Spreadsheet

    Code in a standard code module

    Please Login or Register  to view this content.
    You can assign the same macro to all buttons.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Cmd Button Code to Display Video in Windows Media Player Object in Spreadsheet

    This code doesn't require the object, it calls up MediaPlayer

    In a Standard module
    Please Login or Register  to view this content.
    In the sheet module
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Thumbs up Re: Cmd Button Code to Display Video in Windows Media Player Object in Spreadsheet

    Andy - Popped the code in & it worked straight off the bat! Thank You!
    Roy - I'll keep note of that code, but for the time being I need the vids to show on the object within the sheet, in my predefined size window.

    Thank You both for your help!
    Cheers!

  5. #5
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Thumbs up Re: Cmd Button Code to Display Video in Windows Media Player Object in Spreadsheet

    Hey,

    I thought there could be another way of doing it, by having a drop-down list and just one button instead of separate buttons for all videos.

    Refer the attached file.

    The code used is:
    Please Login or Register  to view this content.
    Andy is the best, of course .

    --Karan--

  6. #6
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Cmd Button Code to Display Video in Windows Media Player Object in Spreadsheet

    Well, the attached file is here
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Thumbs up Re: Cmd Button Code to Display Video in Windows Media Player Object in Spreadsheet

    Thanks Karan, for this particular application I will require separate buttons - But that's damn handy to know for the future!
    Cheers!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1