![]() |
Nested Forms & SendKeys
Why not use a suitable control on your userform to play the file instead of
Shell/SendKeys. Then you have full control over play/stop etc. Maybe the MS MultiMedia control . Don't know if it is worth it for you, but there is also the Speech capability of the Windows SAPI, or Excel Speech in versions 2002 and up. That way you can "play" any arbitrary text, without the recorded file. I can't say how efficient/effective either method would be. NickHK "Phil1982" wrote in message ... Hi...Could you see if you can spot where I'm going wrong please I need to produce a 100 word presentation on why I should be chosen for the finance job I applied for. They've said they want you to be creative. Excel VBA is a valued skill in this job. I have created a main Form with 3 buttons titled: Experience, Achievements, Values we share. I've then created 3 corresponding minor forms. Each one has a label where I have described my Experience, Achievements or Values. Each one also has a close button. When one of the 3 main Form buttons is pressed and the corresponding minor form/answer opens, I have told it to play a particular MP3 file. When the user clicks the close button on the minor form, ***I am trying to tell it to close Windows Media Player and the minor form*** I have got it to play the MP3 file, but when I click the close button, the macro comes up with Run-time error 5 and the debug highlights the "AppActivate PlayFile" line in the code I have copied below: --------------- If I right click on MainForm, then ViewCode.....this is SOME of the code I've done Sub WhyMeButtonA_Click() PlayFile = Shell( _ "C:\Program Files\Windows Media Player\wmplayer.exe ""C:\Documents and Settings\Phil\Desktop\Music Files\Worktogether.mp3", 1) ExperienceForm.Show End Sub ----------------------- If I right click on ExperienceForm, then ViewCode.....this is ALL the code I've done Sub CommandButton1_Click() Unload ExperienceForm AppActivate PlayFile SendKeys "^w", True End Sub ----------------------- I guess I'm not understanding something about nested Forms. Any help would be appreciated. Thank you Phil1982 |
All times are GMT +1. The time now is 02:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com