View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default launch any file type from excel macro

Add START in the command line:

Shell ("Start C:\Bridge Scorer\Manual.doc")

but John Walkenbach previously posted:

The DOS Start command does not work with all versions of Windows. Try using
the ShellExecute API function.

Put this at the top of your module:

Private 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

Then use a procedure like this:

Sub OpenWordDoc()
WordDoc = "C:\Bridge Scorer\Manual.doc"
ShellExecute 0&, vbNullString, WordDoc, vbNullString, vbNullString,
vbNormalFocus
End Sub

John Walkenbach
For Excel tips, macros, & downloads...
http://j-walk.com/ss

--
Regards,
Tom Ogilvy



"arron laing " wrote in message
...
I would prefer to use the code option but I have tried the help on SHELL
and I can't seem to make it work unless the file is a .exe.

I assumed the comand would be -

SHELL(file,1)

where file is the full path and filename (ie k:\project\...\test.dwg

What am I doing wrong?

Cheers

Arron


---
Message posted from http://www.ExcelForum.com/