Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Close the other application

For the life of me, I cannot remember how to get the application I've called
with Shell function to close.

Here's my code:

Private Sub lstElves_Click()
Dim person As String, naughty As Integer, santasez As String
person = Me!lstElves.Column(0) 'user picks name on list
naughty = Int(Rnd() * 100) 'random value generated

'determines naughty and nice
If naughty Mod 2 = 0 Then
santasez = "You've Been " & vbCrLf & "Very Nice!"
MakeSound = Shell("C:\Program Files\Windows Media Player\wmplayer.exe
c:\xmas\hohoho.wav", 0)
Else
santasez = "You've Been " & vbCrLf & "Very Naughty!"
MakeSound = Shell("C:\Program Files\Windows Media Player\wmplayer.exe
c:\xmas\humbug.wav", 0)
End If

'displays personalized message while Hohoho or Humbug is playing in background
Me!lblSez = person & ", " & vbCrLf & "Santa Says " & santasez
End Sub

problem is wmplayer needs to close at end of each cycle, else wmplayer
becomes visible the second time through

All this is through an Excel form. Having brain-block. So far anything
I've tried closes the Excel form, not the wmplayer application.

Many thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Close the other application

As I recall the SHELL function, you hand it the executable and
parameters, followed by the "verb" that the application is to perform. In
this case, you handed the WMPlayer a verb of 0 (zero). I'm guessing that
this makes it play. You'll need to find the verb that closes the instance of
the WMPlayer after each tune is finished. I haven't played with the SHELL
command for a long time so I can only suggest that you do more homework (if
you haven't done so already).

Steve in Ohio

"Lulu" wrote:

For the life of me, I cannot remember how to get the application I've called
with Shell function to close.

Here's my code:

Private Sub lstElves_Click()
Dim person As String, naughty As Integer, santasez As String
person = Me!lstElves.Column(0) 'user picks name on list
naughty = Int(Rnd() * 100) 'random value generated

'determines naughty and nice
If naughty Mod 2 = 0 Then
santasez = "You've Been " & vbCrLf & "Very Nice!"
MakeSound = Shell("C:\Program Files\Windows Media Player\wmplayer.exe
c:\xmas\hohoho.wav", 0)
Else
santasez = "You've Been " & vbCrLf & "Very Naughty!"
MakeSound = Shell("C:\Program Files\Windows Media Player\wmplayer.exe
c:\xmas\humbug.wav", 0)
End If

'displays personalized message while Hohoho or Humbug is playing in background
Me!lblSez = person & ", " & vbCrLf & "Santa Says " & santasez
End Sub

problem is wmplayer needs to close at end of each cycle, else wmplayer
becomes visible the second time through

All this is through an Excel form. Having brain-block. So far anything
I've tried closes the Excel form, not the wmplayer application.

Many thanks.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to close Excel Application in IE Pommy Excel Discussion (Misc queries) 3 November 24th 05 03:36 PM
close excel application. VJ Excel Programming 3 October 22nd 04 03:00 AM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
Close External Application using VBA ZABU Excel Programming 9 June 8th 04 03:33 AM
Application.Close Nichevo Excel Programming 3 December 23rd 03 03:33 PM


All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"