gud day

I made a software in which it is possible to save data to an Excel sheet. Now, I would like to program that one can open this sheet and the saved data is then (automatically) loaded into some textboxes of the forms in the VB software. The data is saved in specific cells on the excel sheet.

What I should know is :
1. How to load an Excel file or Excel sheet in a simpe VB software?
2. How to define the specific cells on the Excel sheet
3. How to put the data of the Excel sheet into the textbox or label of the VB forms?

thanks in advance,

Recommended Answers

All 5 Replies

Member Avatar for abbajee

1- Okie Just Start Vb
2- Put Data copntrol on your form
3- Goto Data1 properties & in the "Connect" property chose your default version of excel & in the "DatabaseName" property browse for your excel file you want to connect with vb & in the "RecordSource" property chose your required sheet
4-Put your labels & text boxes on the Form according to your work & you are done
you can change data add data, delete, edit through vb & excel too
Best of luck

good day to you..

I try your steps and it works! thanks!
what if im using an ADO DC control it is also possible?

thanks in advance..

Member Avatar for abbajee

I prefer using Data Control for this task anyway if u want to achive this task with Ado then remove your Data Control & insert Ado Control, Now right click your Ado Control click"Use Connection String " and click the "Build" button form "Provider" Tab chose your required provider "Microsoft Jet4.0 OLE DB Provider" will suit your needs. when u done with provider click next button No click
1- Select or enter a database name click the button to browse your desired excel databse notice that it will let you select only Microsoft Access Database you need to click there where it's saying "Files of type" click it & chose All files, now this will show you ur excel file too click ur desired file now goto tab as you previously used "Provider","Connection"click on the All Tab there you'll see alot of properties you need to fix or edit the "Extended Properties" this will be empty you neeed to edit this field & type Excel 8.0; there so u've been made connection to ur excel file
now again right click ur Ado control and select RecordSource Tab in the Command Text (SQL) enter these values SELECT *FROM [Sheet1$] or your desired name of ur excel book sheet name
Congratulations u done now u can chage your controls datasource properties to Ado & the field properties to your required fields
hope it's simple for u now

hello!

It works....thanks a lot!
you have the best answer in my problem about excel..

more powers....

dollmar

Member Avatar for abbajee

thanx & best of luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.