I have been able to open Word.exe using the shell function. The problem is how to open the Word file that was listed in the common dialog box. Is there a way to pass the commonDialog.filename to the Shell funtion so the file will automatically open as a Word document.
I found an earlier thread to open a Word document from a VB program. The following are the codes originally written by dsi. Thanks dsi for your codes. I included some codes to open the Word document from the common dialog open box.
'include the Microsoft Word Object Library in
' project references.
Dim strFile As String ' variable for the file name
clgOpen.ShowOpen ' common dialog box
strFile = clgOpen.FileName ' returned file name
'the rest are the codes written by dsi (programmer)
Dim wdApp As Word.Application
Set wdApp = New Word.Application
wdApp.Visible = True
wdApp.WindowState = wdWindowStateMaximize
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.