Hi,

Is there anyone who can provide VB code to open "Open With" dialogbox?

Thanks

Allen

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.

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.

:) thanx for that Dani.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.