473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Save Data into Excel

Hi,
if any one please clear my doubt.
i created one form in vb.it contains(empid,othertsk,descrption....etc)
if any user fill these details click ok then these details are saved into the Excel file.
can anyone tell how to write the code for above form?
May 30 '07 #1
2 1613
Dököll
2,364 Expert 2GB
Hi,
if any one please clear my doubt.
i created one form in vb.it contains(empid,othertsk,descrption....etc)
if any user fill these details click ok then these details are saved into the Excel file.
can anyone tell how to write the code for above form?
Hey there, susisri!

Here is a very simple connection to Excel, you'll need to do some leg work to do what you need though:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'Declare variables here and be sure to add a reference
  3. Go to Project/References and Check Microsoft Excel 9.0 Object library.
  4. Dim xl As New Excel.Application
  5. Dim xlsheet As Excel.Worksheet
  6. Dim xlWBook As Excel.Workbook
  7. 'Don't forget to Quit or you'll have restart your machine/program.
  8. Private Sub Load2Excel_Click() 'Your button
  9.     xlsheet.Cells(1, 1) = Text1.Text
  10.     xlsheet.Cells(1, 2) = Text2.Text
  11.    xlWBook.Save
  12.     xl.ActiveWorkbook.Close False, "C:\Excel_Me.xls"
  13.     xl.Quit
  14. End Sub
  15.  
  16. Private Sub Form_Load()
  17.     Set xlWBook = xl.Workbooks.Open("C:\Excel_Me.xls")
  18.     Set xlsheet = xlWBook.Sheets.Item(1)
  19. End Sub
  20.  
  21. Private Sub Form_Unload(Cancel As Integer)
  22.     Set xlWBook = Nothing
  23.     Set xl = Nothing
  24. End Sub
  25.  
  26.  
Good luck and welcome!
May 31 '07 #2
wassup
34
Hi,
if any one please clear my doubt.
i created one form in vb.it contains(empid,othertsk,descrption....etc)
if any user fill these details click ok then these details are saved into the Excel file.
can anyone tell how to write the code for above form?
Hi susisri,
you can try to read this thread.
http://www.thescripts.com/forum/thread645157.html
it may help you a lot.
Jun 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Aliza Klein | last post by:
I am new to ASP so please pardon me if this is crazy. I have data that I want to allow the user to be able to save in a format that will then enable the user to open the data in Excel. (I have...
8
by: Colleyville Alan | last post by:
I have been working on an Access app that takes info from a file and writes it to a spreadsheet on a form, simultaneously saving the spreadsheet to Excel. I got the idea that the same concept...
0
by: I Decker | last post by:
Hi all, Hope this is the right group. I am writing a program in c# to open create an excel document, enter some data, save it and then email it as an attachment. I have successfully created...
3
by: yaya via DotNetMonster.com | last post by:
Hi, I'm using OleDb to read an excel files and display the data in a datagrid (using dataset as data source), after modifying the data on datagird, how can I save the changes back into Excel files. ...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
2
by: monsieur.marco | last post by:
Hi all, Does anybody know how to save localization in an excel workbook (C# 1.1)? I'm not sure this is possible, but I'm trying to do this so that numberColumns keep their format no matter what...
0
Boxcar74
by: Boxcar74 | last post by:
Hi Everybody!!! I have an Issue. I have an Excel file that queries an Access db. I’m trying to have it so I don’t have to keep updating it manually everyday and save it to a network drive...
3
by: S_K | last post by:
Hi, I have a problem when I try to save a .CSV file from an ASP.NET web page and the client has Excel open already. The symptoms are: 1) The web page is currently displaying the Excel...
2
by: chike_oji | last post by:
Please can someone help me. I am writing a web application, that allows for the upload of an excel sheet into the database. I have an upload button and a save button. The upload button allows...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.