XL 2010 ouvrir wmplayer en 1er plan

herve62

XLDnaute Barbatruc
Supporter XLD
Bonsoir
Dans un USF , j'ai plusieurs choix d'affichage de fichiers ( du PDF > avec adobe reader ; du DOCX > avec Word ....)
Là pas de soucis les appli se mettent au 1er plan
Le Pb avec les MP4 Wmplayer se met en barre des taches ?
J'utilise cette fonction qui est universelle pour tous les choix d'ouverture mais pas d'option de faire du style : AppActivate ("wmplayer"), 1 ... si cela fonctionne? ou de mettre Vbnormalfocus ... je ne sais pas
Y a t-il une solution ?
VB:
Public Function OuvrirFichier(choixpdf As String)

On Error GoTo OuvertureFichierErreur
    
   Dim MonApplication As Object
   Set MonApplication = CreateObject("Shell.Application")
      MonApplication.Open (choixpdf)
    OuvrirFichier = True
   Set MonApplication = Nothing
 
Exit Function
OuvertureFichierErreur:
   Set MonApplication = Nothing
    OuvrirFichier = False
End Function
 
Dernière édition:

Phil69970

XLDnaute Barbatruc
Bonjour Herve62, le forum

2 pistes :

1 de patricktoulon ==> https://www.developpez.net/forums/d...l/ouvrir-windows-media-player-partir-d-excel/

et 1 de silkyroad ==>https://silkyroad.developpez.com/VBA/WindowsMediaPlayer/

VB:
Function WmPlaySound(MySound)
      Dim WshShell
      Set WshShell = CreateObject("WScript.Shell")
      WshShell.Run "wmplayer " & DblQuote(MySound) & "", 1, False
      Set WshShell = Nothing
   End Function
Function DblQuote(Str)
   DblQuote = Chr(34) & Str & Chr(34)
End Function
Sub test()
musique = "H:\mes musique\Amy Mc Donald\This is the Life - Amy Mac Donald\This is the Life\02 - This is the life2.mp3"
WmPlaySound musique
End Sub

Cordialement
 

Statistiques des forums

Discussions
311 721
Messages
2 081 928
Membres
101 842
dernier inscrit
seb0390