3
Contributors
3
Replies
5
Views
11 Years
Discussion Span
Last Post by Comatose
0

in a code module:

Public 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

Sub OpenWith(ByVal xFileName As String)
    ShellExecute 0, vbNullString, "RUNDLL32.EXE", "shell32.dll,OpenAs_RunDLL " & xFileName, "", vbNormalFocus
End Sub

And then wherever you want to show it:

call openwith("somefile.txt")

Let me know how it turns out.

0

Received this via email:

Hello, DaniWeb IT Community team

Thank your very much for your replying about my problem. It works.

Best regards,

Allenhu

Marking thread as solved.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.