by Tyler (4 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(7 Votes)
This 1 line of code will Open any file with their correct default program. EX: opens .Doc file with winword and .Zip file with WinZip..Or any file with their default program..
API DeclarationsPrivate 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
Private Function openfile(file As String)
Call ShellExecute(0&, vbNullString, file, vbNullString, vbNullString, vbNormalFocus)
End Function
'' That's it!..
'' Please Vote..:-)