Addressing / Using videos stored in the XML / Media subfolder

VenturSum

Board Regular
Joined
May 23, 2010
Messages
138
Team,

I have a video that I want to play using MS Media Player within an Excel form.

Normally, the videos URL is a website like youtube.com.
I would like to store the video in the XML //XL/Media/ folder.

How would I address the file in the //XL/Media folder in the URL filed?

Any help would be appreciated.

Thank you,

John Orlando
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Opennative app will open any file in its app: .xls will open in excel, .mov will open in the assigned player, etc
save this code into a module, then usage is:

OpenNativeApp Cell(r,c)

where the cell is the path to the video, either web link, or path on a server.
if a web link, it will open the default web browser
if a server path, it will open in the default player


Code:
Option Explicit

#If Win64 Then
  'Declare PtrSafe Sub...
    Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
    Declare PtrSafe Function GetDesktopWindow Lib "user32" () As Long
#Else
   Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
   Private Declare Function GetDesktopWindow Lib "user32" () As Long
#End If

Const SW_SHOWNORMAL = 1
Const SE_ERR_FNF = 2&
Const SE_ERR_PNF = 3&
Const SE_ERR_ACCESSDENIED = 5&
Const SE_ERR_OOM = 8&
Const SE_ERR_DLLNOTFOUND = 32&
Const SE_ERR_SHARE = 26&
Const SE_ERR_ASSOCINCOMPLETE = 27&
Const SE_ERR_DDETIMEOUT = 28&
Const SE_ERR_DDEFAIL = 29&
Const SE_ERR_DDEBUSY = 30&
Const SE_ERR_NOASSOC = 31&
Const ERROR_BAD_FORMAT = 11&




Public Sub OpenNativeApp(ByVal psDocName As String)
Dim r As Long, Msg As String

r = StartDoc(psDocName)
If r <= 32 Then
    'There was an error
    Select Case r
        Case SE_ERR_FNF
            Msg = "File not found"
        Case SE_ERR_PNF
            Msg = "Path not found"
        Case SE_ERR_ACCESSDENIED
            Msg = "Access denied"
        Case SE_ERR_OOM
            Msg = "Out of memory"
        Case SE_ERR_DLLNOTFOUND
            Msg = "DLL not found"
        Case SE_ERR_SHARE
            Msg = "A sharing violation occurred"
        Case SE_ERR_ASSOCINCOMPLETE
            Msg = "Incomplete or invalid file association"
        Case SE_ERR_DDETIMEOUT
            Msg = "DDE Time out"
        Case SE_ERR_DDEFAIL
            Msg = "DDE transaction failed"
        Case SE_ERR_DDEBUSY
            Msg = "DDE busy"
        Case SE_ERR_NOASSOC
            Msg = "No association for file extension"
        Case ERROR_BAD_FORMAT
            Msg = "Invalid EXE file or error in EXE image"
        Case Else
            Msg = "Unknown error"
    End Select
'    MsgBox msg
End If
End Sub

Private Function StartDoc(psDocName As String) As Long
Dim Scr_hDC As Long

Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", psDocName, "", "C:\", SW_SHOWNORMAL)
End Function
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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