- Home
·
- Libraries
·
- Execute a file with any extension .doc,.xls,.bmp as long the application is install in windows
Execute a file with any extension .doc,.xls,.bmp as long the application is install in windows
Pass the file name and the function wil check from windows what is the application exe to run the file.Exp you want to run a abc.doc document from your program,u need to know msword.exe path and then you run the shell(applicate exe abc.doc,1) to execute the abc.doc
This work with any extension as long as it register to windows. etc .xls,.vbp,.doc
Inputs
strname = "Full path of your file"
exp C:\Myfolder\Abc.doc or C:\abc.xls or c:\abc.bmp
Returns
Execute a file with any extension
for more access www.efastclick.com
API Declarations
Private Declare Function FindExecutable _
Lib "shell32.dll" Alias "FindExecutableA" _
(ByVal lpFile As String, _
ByVal lpDirectory As String, _
ByVal lpResult As String) As Long
Rate Execute a file with any extension .doc,.xls,.bmp as long the application is install in windows
(5(5 Vote))
Public Function runapp(strname As String, appname As String) As Long
Dim strResult As String
Dim lngResult As Long
Dim i, s_msg
s_msg = MsgBox("Launch " & appname & " ?", vbYesNo, appname)
If s_msg = vbYes Then
strResult = String(255, 0)
lngResult = FindExecutable(strname, vbNullString, strResult)
strResult = Trim(Replace(strResult, "/dde", "", 1))
'run the file and not an .exe file
i = Shell(Trim(Replace(strResult, vbNullChar, "", 1)) & " " & strname, 1)
End If
End Function
Execute a file with any extension .doc,.xls,.bmp as long the application is install in windows Comments
No comments yet — be the first to post one!
Post a Comment