![]() |
can you import an mp3 to VB in Excel '03 to be played when a form.
I want to save an mp3 file in my code to be played when a certain user form
opens. The help file says that sounds have been removed from excel. Can I do this? |
can you import an mp3 to VB in Excel '03 to be played when a form.
Not using anything native to Excel, at least not that I am aware of. You
would need to have a reference to an mp3 player (e.g. Windows Media Player) in your project (and make sure you can distribute it to all users) and then use the mp3 player's object model to load and play your file. "alan5022" wrote: I want to save an mp3 file in my code to be played when a certain user form opens. The help file says that sounds have been removed from excel. Can I do this? |
can you import an mp3 to VB in Excel '03 to be played when a form.
If you provide the .mp3 file and make sure it's located in the same location as
your workbook, maybe you could just let windows start up the user's MP3 player. In the Userform module: Option Explicit Private Sub UserForm_Initialize() Dim myFileName As String myFileName = ThisWorkbook.Path & "\mymusic.mp3" ShellExecute 0, "", myFileName, "", "", 0 End Sub In a general module: Option Explicit Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long alan5022 wrote: I want to save an mp3 file in my code to be played when a certain user form opens. The help file says that sounds have been removed from excel. Can I do this? -- Dave Peterson |
All times are GMT +1. The time now is 06:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com