ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open a file - Application unknown (https://www.excelbanter.com/excel-programming/386968-open-file-application-unknown.html)

Snirp

Open a file - Application unknown
 
I want to be able to open a file without stating the application to
open it. Not unlike adding a hyperlink to a cell value.

Only, I want it done in VBA since it must take some variables. The
following works great if the path to the application is known.

Dim x As Variant
x = Shell( AppPath & " " & FilePath, 1)

However, i want it to take the windows default application to open the
file. Again, much like the result a hyperlink produces. Simply
omitting the AppPath results in an Error 5, something like "invalid
procedure call or invalid argument".


Snirp

Open a file - Application unknown
 
EDIT: found a solution that works for me:

http://chrisrae.com/vba/routines/shellexecute.html



All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com