Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Just a little question. How can I open MS Excel from VBA or MS Access?


Reply
 
Thread Tools Display Modes
  #1  
Old 10-05-2004, 01:54 AM
Newhire Newhire is offline
Newcomer
 
Join Date: Oct 2004
Posts: 24
Question Just a little question. How can I open MS Excel from VBA or MS Access?


Hi,
I am developing a tool which working between MS Access & MS Excel. But I don't know how to open 1 Excel file (I mean show this Excel file in MS Excel, not just read data within it!). If you know, please tell me how to solve it!
Thanks ahead for your support.
__________________
Money is not problem, just no money is a big problem
Reply With Quote
  #2  
Old 10-05-2004, 03:02 AM
Jonny's Avatar
Jonny Jonny is offline
Senior Contributor
 
Join Date: Jun 2003
Location: Birmingham, England, UK
Posts: 821
Default

use the ShellExecute API... there is a link to an example at the bottom of the page.
__________________
Regards
John, jlsd.co.uk
Reply With Quote
  #3  
Old 10-06-2004, 12:14 AM
thorran thorran is offline
Newcomer
 
Join Date: Sep 2004
Posts: 3
Default

Quote:
Originally Posted by Newhire
Hi,
I am developing a tool which working between MS Access & MS Excel. But I don't know how to open 1 Excel file (I mean show this Excel file in MS Excel, not just read data within it!). If you know, please tell me how to solve it!
Thanks ahead for your support.

Another approach to the shell execute function would be to create an object and then set the value of that object to the file that you need as long as you are know that file name. Below is an example of what I am talking about.

Dim xl As Object
Set xl = GetObject("c:\program files\BHA Builder\BHA.xls")
Then you make the object visible and off you go.

You will need to add a reference to MS Excel and/or MS Access in your project as well. Then you can call on all their functions in your code as well.

Good luck
Thorran
Reply With Quote
  #4  
Old 10-06-2004, 11:30 AM
Kluz's Avatar
Kluz Kluz is offline
Sapience.Aquire

Super Moderator
* Expert *
 
Join Date: Oct 2003
Location: Lake Bluff, Ill., U.S.
Posts: 3,306
Default

You would want to read this automation tutorial for excellent information about automating Excel.
__________________
No the other right mouse click
Reply With Quote
  #5  
Old 10-07-2004, 02:04 AM
Newhire Newhire is offline
Newcomer
 
Join Date: Oct 2004
Posts: 24
Talking

Thank Jonny and all,
It worked. Many thanks again. :-)
__________________
Money is not problem, just no money is a big problem
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->