Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exporting VB.NET datagrid to an excel sheet

Posted on 2002-03-14
5
Medium Priority
?
450 Views
Last Modified: 2010-05-02
Hi,

anyone got any code so that I can export a VB.NET datagrid dataset to an excel sheet?

Thanks,

Del.
0
Comment
Question by:deljones
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 17

Expert Comment

by:inthedark
ID: 6864138
Simple was is to place the grid onto the clipboard, then is can be pasted anywhere:

The clipboard format required by excel is like:


Field1 TAB Field2 TAB Field3 TAB Field4 vbCrLf

Where tab is CHR(9)

Each row looks the same.
0
 

Author Comment

by:deljones
ID: 6864157
Thanks,

but I really need to do it in code.  I want my users to be able to export at will to an excel sheet.
0
 
LVL 44

Accepted Solution

by:
bruintje earned 1200 total points
ID: 6865660
Hi deljones, don't know if there are any sample exactly like your question but i guess with these samples you can get to it

Microsoft Knowledge Base articles can be found at:
http://search.support.microsoft.com/kb/c.asp
Choose to search by "specific article ID number"
Enter the article number including the "Q"

dotNet
------
Q306022 HOW TO: Transfer Data to an Excel Workbook Using Visual Basic .NET
(pending)
Q306572 HOW TO: Query and Display Excel Data Using ASP.NET, ADO.NET
Q311731 HOW TO: Query and Display Excel Data Using ADO.NET, VB .NET

General
-------
Q257819 HOWTO: Use ADO with Excel Data from Visual Basic or VBA
Q303814 HOWTO: Use ADOX with Excel Data from Visual Basic or VBA

Transferring Data into Excel
----------------------------
Q247412 INFO: Methods for Transferring Data to Excel from Visual Basic
Q295646 HOWTO: Transfer Data from ADO Data Source to Excel with ADO

HTH:O)Bruintje
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7618284
Hi deljones,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept bruintje's comment(s) as an answer.

deljones, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:kodiakbear
ID: 7665726
Moving to the paq

kb
Experts Exchange Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question