Re: opening word Doc from VB application
Graham Charles <[email protected]> Thu, 3 Oct 2002 23:42:30 -0700
| Newsgroups | gmane.comp.windows.devel.vbcom |
|---|---|
| Organization | Ars Indicii Information Design |
| Message-ID | <[email protected]> |
Mashkoor: You can use the ShellExecute API to open a file with its associated application; that's the cleanest way---you shouldn't have to send the location of the executable: ShellExecute hWnd, "open", "FileName.doc", vbNullString, vbNullString, 1& You could also create a Word.Application object; that's a reasonable way to do what you want, as well, but requires the OLE overhead so it's really only worthwhile if you're planning to automate the document beyond just opening it. However, if you really want the location of the actual Word executable (and I've not yet found a reason to need this), you can examine the registry key "Path" at HKLM\Software\Microsoft\Office\9.0\Word\InstallRoot ...for a directory, and then check that directory for the presence of WINWORD.EXE. You'll have to step through version values (9.0, 10.0, 11.0) until you find the key. But the first ways are really better. g. -----Original Message----- From: Technical discussion of VBCOM [mailto:[email protected]] On Behalf Of Mashkoor Ali Sent: Thursday, October 03, 2002 10:06 PM To: [email protected] Subject: [VBCOM] opening word Doc from VB application Hi I have to open a word document from VB application I know the shell command can do it but it requires the path to word.exe. can somebody help me i'll be very thankfull Mashkoor Ali You can read messages from the VBCOM archive, unsubscribe from VBCOM, or subscribe to other DevelopMentor lists at http://discuss.develop.com.