how do insert excell ws into vb project ?

please tell me how do i insert excell ws into the vb project ?

what control / components do i need insert ?

for your information i just want to insert abc.xls file only not the excell.exe. so my user can manipulate or using that ws as he/she like.

and that ws can be link with the data control.

i hope you understand it.

u got to answer the 3 question above.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
The simple answer to the first two questions, is to add an ole container control to the form.

Create a new project and add the ole control to the form, select create from file and point to abc.xls.

Run the project. When you double-click the control (you can do this programmatically as well). It will open a cut-down representation of excel in the current form which gives you full excel functionality. You can also use the excel automation object to programatically control the worksheet.

The third part of the question is contradictory to the first two because if you open the worksheet in this way there is no need to control it using the data control.

Place an MS Data Bound Grid Control from under the Project/Components menu option onto your form.  Then place a Data control onto your form.

Set the Data controls Connect property to Excel 8.0.

Set the Data controls DatabaseName property to the name of your excel sheet.

Choose the Data controls Record Source from the RecordSource property drop down list.

Set the Data controls RecordSetType to table.

Set the Data controls Visible property to false (if you like).

Set the DBGrids DataSource to Data1 from the drop down list.

Hit Run.

Thats it!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JOHNHOAuthor Commented:

1. why in my components didnt see the ole object ? what and how do i get it ?

2. why when i try to set the recordsource with the xls file, it shows me that "coudnt ecrytp data"

TimCotteeHead of Software ServicesCommented:
The OLE object should be in your toolbox. It is usually the last one when you create a standard vb project after the intrinsic data control.
If you use the OLE control then the copy of excel it uses is the actual excel.exe - if this is not on the machine it won't work.  Using the DBGrid gets around this.  

As for the couldn't encrypt data message - I'm not sure.  I can't reproduce that here - there may be a problem with you xls file - it may have complex entries that the data control cannot understand.  If you want you could send me a copy of the xls at and I can take a look.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.