Help with Shell command from VBA in Excel 
Author Message
 Help with Shell command from VBA in Excel

Shell takes a WindowStyle argument.  Check it out in Help.

Jim



Fri, 28 Apr 2000 03:00:00 GMT
 Help with Shell command from VBA in Excel

I have an Excel form with a button.  When the button is clicked, I'd like
 it to play a verbal warning.  I try to accomplish this with:

        Shell ("c:\winnt\system32\mplay32.exe  c:\warning.wav")

This results in the Media Player being opened, and then immediately
being minimzed and placed on the taskbar.

I am able to bring it to the foreground with:

        Sendkeys "%{TAB}"

Which simultes the Alt-Tab (what a kludge).  Then I try to play it with:

        Sendkeys "%P"

which doesn't work.  However, if I run this code, and then press
Alt-P myself, the thing plays.

Help!  How can I do this?  Many, many thanks.
Steve
PS:  I've also unsuccessfully tried this with sndrec32.exe

----------------
Steve Silberberg

Visit the Air Sickness Bag Museum at:
http://rampages.onramp.net/~stevebo/airsick.html
FACT:  Buff Babes Dig Cut Dudes!



Fri, 28 Apr 2000 03:00:00 GMT
 Help with Shell command from VBA in Excel

Quote:

>Shell takes a WindowStyle argument.  Check it out in Help.

Thanks.  I tried it, but I think "SendKeys" is failing to send the Alt-P to
Media Player.

----------------
Steve Silberberg

Visit the Air Sickness Bag Museum at:
http://rampages.onramp.net/~stevebo/airsick.html
FACT:  Buff Babes Dig Cut Dudes!



Sat, 29 Apr 2000 03:00:00 GMT
 Help with Shell command from VBA in Excel

We're not communicating.  I'm asking what happens when you supply the window
style parameter like this:

Shell "c:\winnt\system32\mplay32.exe /Play /Close c:\warning.wav", 1

No Sendkeys at all.

Jim



Sat, 29 Apr 2000 03:00:00 GMT
 Help with Shell command from VBA in Excel

Quote:

>We're not communicating.  I'm asking what happens when you supply the window
>style parameter like this:

>Shell "c:\winnt\system32\mplay32.exe /Play /Close c:\warning.wav", 1

>No Sendkeys at all.

Jim,
        THANK YOU THANK YOU THANK YOU!!!!!!

That worked great!  The philosophical bit of information I was missing was the
command line parameters to mplay32.exe.  I didn't realize that Excel was
working fine, but the player needed command line switches.  I pored over
mplay32's on-line documentation and found no mention of it.  Furthermore,
        mplay32 /?
returns nothing in Dos.  So THANK YOU again.

        One more question if I may.  How do I get this warning to play as an
auto execution macro at start up?
Steve

----------------
Steve Silberberg

Visit the Air Sickness Bag Museum at:
http://rampages.onramp.net/~stevebo/airsick.html
FACT:  Buff Babes Dig Cut Dudes!



Sat, 29 Apr 2000 03:00:00 GMT
 Help with Shell command from VBA in Excel

Steve,

You can assign you macro to Workbook auto_open
event.

Private Sub Auto_Open()
    Your Macro
End Sub ()

Regards, Davie

That worked great!  The philosophical bit of information I was missing was the

Quote:
> command line parameters to mplay32.exe.  I didn't realize that Excel was
> working fine, but the player needed command line switches.  I pored over
> mplay32's on-line documentation and found no mention of it.  Furthermore,
> mplay32 /?
> returns nothing in Dos.  So THANK YOU again.

>         One more question if I may.  How do I get this warning to play as an
> auto execution macro at start up?
> Steve

> ----------------
> Steve Silberberg

> Visit the Air Sickness Bag Museum at:
> http://rampages.onramp.net/~stevebo/airsick.html
> FACT:  Buff Babes Dig Cut Dudes!



Sat, 29 Apr 2000 03:00:00 GMT
 
 [ 6 post ] 

 Relevant Pages 

1. Error with VBA FileCopy Command in Excel

2. Please help - VBA DAO for Excel 7.0

3. Need Help with VBA reading Excel using ADO

4. Please Help - VBA DAO in EXCEL 7.0

5. Excel VBA In ActiveX Help

6. Need Help Manipulating Excel 2000 from Access 2000 using VBA

7. Help with the shell command

8. Help, command shell execution

9. Help! SHELL COMMAND

10. Please help : Shell Command

11. svrmgrl error when executed on root shell(all shells excepts oracle shell)

12. MDX queries Excel and VBA


 
Powered by phpBB® Forum Software