Opening a Word Document

scottharr27
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?

MiguelS
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
Const SW_SHOWNORMAL = 1

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

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum