Opening a Word Document

06-02-2005, 11:37 AM
Normally, to open say an excel document with my VB app, I would just have to give a command like:

Shell "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE " & File1.Path & "\" & File1.FileName, vbNormalFocus

However, this does not seem to work with Word Documents, as it opens up Word but gives me an error. Does anyone know a good way to open a word document with the click of a button?

06-03-2005, 03:44 AM
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

ShellExecute Me.hwnd, vbNullString, File1.FileName, vbNullString, "C:\", SW_SHOWNORMAL

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum