How to execute or load a document in VB

dabellei
dabellei used Ask the Experts™
on
I have an application that use some different kind of documents I want to put a button to open them in my app, by using external program .

Like a .doc document using Word
a .bmp using paint or what so ever...

A tried  shell("winword.exe" & " aa.doc") that is not working.

and how can I open a document using the associate in windows??  I don't want to bother about specifying the program I want to open.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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


'Example call

Call ShellExecute(0, "open", "aa.doc", vbNullString, vbNullString, 2)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial