Solved

Creating and Deleting worksheets in Excel usign Visual Studio

Posted on 2010-08-30
1
264 Views
Last Modified: 2013-11-27
I want to export data to an existing excel spreadsheet and into a specific worksheet. Each time I will need to delete and then re-create the worksheet. But I do not know what the command is for either. I tried the following to create it and it processed thru without error but i do not see it when I open the spreadsheet (it did not previously exist). I am using Visual Studio 2008.

        Dim SQL1 = "Create Table [TestData2]"

        Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & “c:\test.xls” & ";" & _
        "Extended Properties=""Excel 8.0;HDR=YES""")

        ExcelConnection.Open()
        Dim ExcelCommand As New System.Data.OleDb.OleDbCommand(SQL1, ExcelConnection)
        ExcelCommand.ExecuteNonQuery()


0
Comment
Question by:PHFrench
[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
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
ID: 33613007
If you need to recreate the worksheet you need to

1) Drop the table

DROP TABLE [Sheet1$]

2) Create the table

CREATE TABLE [Sheet1$]([Full Name] char(255),[Type] char(255),[Date] char(255),[Num] char(255),[Name City] char(255),[Name State] char(255),[Name Zip] char(255),[Memo] char(255),[Name Account #] char(255),[Name] char(255),[UPC Code] char(255),[Item Description] char(255),[Rep] char(255),[Qty] char(255),[Sales Price] char(255),[Amount] char(255))
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to check group permission on a file located on a remote server ? 3 30
jquery tab header text 1 28
Easy filter aspnet 2 34
Reactjs with .NET 3 74
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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