Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Open .xls or .doc files from within a VB App

Status
Not open for further replies.

gaiya

Programmer
May 16, 2002
4
0
0
GB
I am a numpty VB developer trying to do the above.
I can identify the file either by the CommDialog or by use of drv, dir, fil list boxes but cannot suss out how to open the file.
Any help, code snippets or links appreciated.

Also, will it be the same method in VBA for use within Access?
 
I use

Shell "C:\Program Files\~~~\Excel.exe \\server\~~~\filename.xls"

to open a specific file. If file varies then use

Shell "C:\Program Files\~~~\Excel.exe " & {strFileName}

when {strFileName} is the value of your CommDialog

I do not know if this is differnt for VBA.

Garty
(First Answer posted!!)
 
gaiya,

How do you want the Excel or Word document to open. You can open the actual application (Word or Excel) or you can use an OLE container to open the document from within the app either embedded or linked. You can also use the webbrowser control to open the document from within the app for the purpose of viewing. Anything is possible, the problem is I only have one lifetime.
[cheers]
 
Hi,
You may use the Word Object Liybrary and the Excel O. L (check it in Your references), declare a new Word.Aplication (exc.app) object and trogh this You can open, modify, print etc. the file (even without showing it -You can do almoust everything what You can do from inside of Word or Excel).
Or You can use the CrateObject - see the VB help.

And this stuff works anywhere in office (for ex. You can open an Excel file from Word or Access).

Tibi

Sorry for my english
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top