View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_676_] Leith Ross[_676_] is offline
external usenet poster
 
Posts: 1
Default Open a non xls file (emulate the double-click from Windows Explore


Hello Budget

You need to use the ShellExecute API call. Copy this code and paste i
into a VBA code module in your project. This will launch any registere
file type's associated application

Code
-------------------

Public Const ShowNormal As Long =
Public Const ShowMinimized As Long =

Public 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 Lon

Public Sub OpenProgram(File_To_Open As String, Show_How As Long
Dim RetVa

RetVal = ShellExecute(0&, "open", File_To_Open, vbNullString, vbNullString, Show_How

End Su

-------------------

Example
OpenProgram "C:\MyFile.avi", ShowMinimize

Sincerely
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=56391