TGB
asked on
Opening Office Apps from within VB
How do you open up any Office document from within VB6.0?
We can open up a Word or Excel document on their own, but we want to add the functionality of allowing the user to open ANY Office document (Project/Word/Excel etc...).
We've tried using "Set pword = CreateObject("office.appli cation")", and adding the Microsoft Office Reference, but to no avail. Please help. Cheers.
We can open up a Word or Excel document on their own, but we want to add the functionality of allowing the user to open ANY Office document (Project/Word/Excel etc...).
We've tried using "Set pword = CreateObject("office.appli
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think I understand your question.. as such I will only prototype it out for you..
1. Add a Tab strip to a form.. Label the tabs Access, Excel, Outlook, Project, Word.
2. For each of the Tab Strip Frames, add a Listbox, and a command button for open.
3. Using FSO.. recursively scan the hard drive.. testing the file extension of each file. Place the the path of all MDB extensions into the Access Listbox.. XLS into the Excel Listbox.. DOC for Word.. (Project and Outlook I don't know right off the top of my head)
4. When the user clicks the Word Tab, a list of all DOC files on the disk will appear.. by clicking on a file path and then clicking on the Open button.. (or if you want.. setup a double click on the Listbox to do both at once).. depending on what Frame you are on..
If you are on the Word Tab..
SHELL "c:\pathname\WORD.EXE " & Listbox.SelectedItem
Excel..
SHELL "c:\pathname\EXCEL.EXE " & Listbox.SelectedItem
etc.. etc.
-------------------------- --------
I'm guessing that is what you have in mind, right? Anyhow.. I am off to dreamland.. good luck.. <smile>.
1. Add a Tab strip to a form.. Label the tabs Access, Excel, Outlook, Project, Word.
2. For each of the Tab Strip Frames, add a Listbox, and a command button for open.
3. Using FSO.. recursively scan the hard drive.. testing the file extension of each file. Place the the path of all MDB extensions into the Access Listbox.. XLS into the Excel Listbox.. DOC for Word.. (Project and Outlook I don't know right off the top of my head)
4. When the user clicks the Word Tab, a list of all DOC files on the disk will appear.. by clicking on a file path and then clicking on the Open button.. (or if you want.. setup a double click on the Listbox to do both at once).. depending on what Frame you are on..
If you are on the Word Tab..
SHELL "c:\pathname\WORD.EXE " & Listbox.SelectedItem
Excel..
SHELL "c:\pathname\EXCEL.EXE " & Listbox.SelectedItem
etc.. etc.
--------------------------
I'm guessing that is what you have in mind, right? Anyhow.. I am off to dreamland.. good luck.. <smile>.
strFileExt is the extension of the file
like
strFileExt = ucase(right(strFileName,3) )
where strFileName = "MyDocument.doc" for example
like
strFileExt = ucase(right(strFileName,3)
where strFileName = "MyDocument.doc" for example
You can use the WebBrowser Control and call the NavigateTo method, supplying the Path to the File. The Document will be opened in the Browser (whenever the Office App is installed).
Components: Microsoft Internet Controls
BTW: This allows you not only to open Office Documents only...
Components: Microsoft Internet Controls
BTW: This allows you not only to open Office Documents only...
You can open any document with a registered file extension using the ShellExecute API function call. If you do not require automation functionality (control of the application) this is the best route to take. See the following for an example:
http://support.microsoft.com/support/kb/articles/Q170/9/18.asp
http://support.microsoft.com/support/kb/articles/Q170/9/18.asp
ASKER
defined as?