VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Open File With Default Editor or Program

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 Declarations
Private 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

Rate Open File With Default Editor or Program

Private Function openfile(file As String)
Call ShellExecute(0&, vbNullString, file, vbNullString, vbNullString, vbNormalFocus)
End Function
'' That's it!..
'' Please Vote..:-)

Download this snippet    Add to My Saved Code

Open File With Default Editor or Program Comments

No comments have been posted about Open File With Default Editor or Program. Why not be the first to post a comment about Open File With Default Editor or Program.

Post your comment

Subject:
Message:
0/1000 characters