Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Shell function

Through searching this site I've found out about the handy Shell function.

One thing that has dissapointed me about it though is that I expected you
could tell it to open files.......but it seems you can only tell it to open
the program

For example this didn't do what I'd hoped
Shell("C:\Music\Elvis.mp3", 1)

I hoped this would open winamp/win media player AND open the file


So does anyone know any tricks for opening non-Office files with VBA.
Preferably without having to use the Sendkeys function.

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Shell function

shell(""C:/program files/yourprogram" "C:/music/your mp3"")
this should work

"Phil1982" wrote:

Through searching this site I've found out about the handy Shell function.

One thing that has dissapointed me about it though is that I expected you
could tell it to open files.......but it seems you can only tell it to open
the program

For example this didn't do what I'd hoped
Shell("C:\Music\Elvis.mp3", 1)

I hoped this would open winamp/win media player AND open the file


So does anyone know any tricks for opening non-Office files with VBA.
Preferably without having to use the Sendkeys function.

Thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Shell function

If you let shell use CMD, it will know the right application for your file:


Sub Macro1()
x = Shell("cmd.exe /c C:\musicguide.mp3", 1)
End Sub
--
Gary's Student


"Phil1982" wrote:

Through searching this site I've found out about the handy Shell function.

One thing that has dissapointed me about it though is that I expected you
could tell it to open files.......but it seems you can only tell it to open
the program

For example this didn't do what I'd hoped
Shell("C:\Music\Elvis.mp3", 1)

I hoped this would open winamp/win media player AND open the file


So does anyone know any tricks for opening non-Office files with VBA.
Preferably without having to use the Sendkeys function.

Thanks in advance

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
Shell function John Keturi Excel Programming 1 May 23rd 04 02:09 AM
Shell function II [email protected] Excel Programming 1 September 19th 03 05:55 PM
Shell function II Don Guillett[_4_] Excel Programming 1 September 19th 03 03:31 PM
Shell function David Excel Programming 0 September 19th 03 11:30 AM
use shell function in vbscript Sofia Excel Programming 0 July 21st 03 06:29 PM


All times are GMT +1. The time now is 02:59 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"