ich würde gerne per vba eine mp4 Datei im Hintergrund abspielen lassen (Excel Oberfläche soll im Vordergrund stehen). Die mp4 Datei liegt bei mir auf dem Desktop.
Hat jemand eine Idee?
Vielen Dank!
Gruß
Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Sub test()
SetForegroundWindow (Application.hwnd)
Application.WindowState = xlMaximized
End Sub
gruß
selli
Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Sub Intro()
Dim basepath As String
Dim audiofile As String
Dim full_filename As String
basepath = "c:\users\Desktop"
audiofile = "test.mp3"
full_filename = basepath & "\test.mp3"
Debug.Print full_filename
Application.ScreenUpdating = False
On Error Resume Next
ActiveSheet.OLEObjects.Add(Filename:=full_filename, Link:=True).Select
If Err.Number 0 Then
MsgBox "Could not play " & ActiveCell.Text
Exit Sub
End If
Selection.Verb
Selection.Delete
SetForegroundWindow (Application.hwnd)
Application.WindowState = xlMaximized
Application.ScreenUpdating = True
Sub mp3_abspielen()
Dim WMP As Object, datei As String
Set WMP = GetObject("new:{6BF52A52-394A-11d3-B153-00C04F79FAA6}")
datei = "C:\Users\Public\Music\Sample Music\Kalimba.mp3" 'anpassen
WMP.URL = datei
Do
DoEvents
Loop Until WMP.playState = 1
WMP.Close
Set WMP = Nothing
End Sub