Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Open a non xls file (emulate the double-click from Windows Exp

Hello,
The ActiveWorkbook.FollowHyperlink worked perfectly. Thanks.
--
Programmer on Budget


"Ron de Bruin" wrote:

Or use

ActiveWorkbook.FollowHyperlink "C:\Test.pdf"



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Leith Ross" wrote in message
...

Hello Budget,

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


Code:
--------------------

Public Const ShowNormal As Long = 1
Public Const ShowMinimized As Long = 2

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 Long

Public Sub OpenProgram(File_To_Open As String, Show_How As Long)
Dim RetVal

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

End Sub

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


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

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=563916




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
Double-click and open .csv file Charles Ingals Setting up and Configuration of Excel 2 April 18th 07 02:12 PM
When opening an excel file in Windows Explore, it opens to a grey. pwink44 Excel Worksheet Functions 2 March 30th 07 07:36 PM
Why can't I double click on a file to open it? bbrivers Excel Discussion (Misc queries) 3 December 2nd 06 05:24 PM
can't open file by double click Mike Morn Excel Discussion (Misc queries) 1 November 16th 05 04:58 PM
Cannot double-click to open file Chris M.[_3_] Excel Programming 6 October 15th 03 12:01 AM


All times are GMT +1. The time now is 06:50 PM.

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

About Us

"It's about Microsoft Excel"