View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
arron laing arron laing is offline
external usenet poster
 
Posts: 1
Default launch any file type from excel macro

I have a macro that lists all the files relating to a project in
single worksheet. As the file list and the directory tree is ver
large, I am trying to write a macro that will launch the selected fil
from the list.

I have managed to work out how to launch .xls and .doc files
using the following code by taking 'file' from the active cell


' file is the full path

If Right(file, 3) = "xls" Then
Workbooks.Open file
End If

If Right(file, 3) = "doc" Then
Set wdapp = CreateObject("Word.Application")
With wdapp
.Documents.Open file
.Visible = True
End With
End If

but this seems a bit cumbersome as there are CAD files, MS projec
files, JPGs, Acrobat files etc.

Is there a universal command that will launch any file type or som
other clever work around.

Cheers

Arro

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