Tools Links Login

Open File With Default Editor or Program

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..

Original Author: Tyler

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

Code

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 79 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.