excel

How to keep row order with SqlBulkCopy?

I'm exporting data programatically from Excel to SQL Server 2005 using SqlBulkCopy. It works great, the only problem I have is that it doesn't preserve the row sequence i have in Excel file. I don't have a column to order by, I just want the records to be inserted in the same order they appear in the Excel Spreadsheet. I can't modify th...

Using tables in UDF's in Excel 2007

I am writing a UDF for Excel 2007 which I want to pass a table to, and then reference parts of that table in the UDF. So, for instance my table called "Stock" may look something like this: Name            Cost            Items in Stock Teddy Bear    £10              10 Lollipops         20p              1000 I have a UDF ...

How do I protect all worksheet in an Excel workbook with a single click?

I have around 25 worksheets in my workbook (Excel spreadsheet). Is there a way I can protect all the 25 worksheets in single click ? or this feature is not available and I will have to write a VBA code to accomplish this. I need very often to protect all sheets and unprotect all sheets and doing individually is time consuming ...

Why does declaring content as a string cause WinHttp to not send HTTP content in Excel VBA?

I have an Excel VBA macro which does the equivalent of the following HTTP POST which works successfully: Set WebClient = CreateObject("WinHttp.WinHttpRequest.5.1") ' ... Configure WebClient for a POST request RequestBody = "<request>" WebClient.send RequestBody Previously, I had explicitly set the type of RequestBody as a String as in...

How to send an email attachment with signature in excel

I would like to know how to write a macro that would send an email attachment in excel with user's signature. The same macro would be used by different users. So it should dynamically read any one (out of multiple html, rtf and txt files) signature file from user's location C:\Documents and Settings\" & Environ("username") "\Application ...

C# how to add Excel Worksheet programatically Office XP / 2003

Hi all, I am just starting to fiddle with Excel via C# to be able to automate the creation, and addition to an Excel file. I can open the file and update the data and move through the existing worksheets. My problem is how can I add new sheets? I tried: Excel.Worksheet newWorksheet; newWorksheet = (Excel.Worksheet)e...

Is it possible to see more than 65536 rows in Excel 2007?

I have an excel file which has more than 65536 rows. However, I can see only first 65536 of them. Is it possible to see all of them in Excel 2007? ...

Excel charts - setting series end dynamically

Hi, I've got a spreadsheet with plenty of graphs in it and one sheet with loads of data feeding those graphs. I've plotted the data on each graph using =Sheet1!$C5:$C$3000 This basically just plots the values in C5 to C3000 on a graph. Regularly though I just want to look at a subset of the data i.e. I might just want to look at t...

Writing VBA in Excel 2007 for use in Excel 2003

Where I'm at the developers have been updated to Excel 2007, but most of the users haven't. I'm building a spreadsheet template (*.xlt) for a user that's gonna need some vba code included, and I'm wondering what issues I'm likely to run into building this in 2007 instead of 2003? I don't have access to a machine with Excel 2003 for tes...

What is the simplest way to export Excel data to Matlab?

What is the simplest way to programmatically export Excel data to Matlab? ...

PHP PEAR Spreadsheet_Excel_Writer sending an empty file.

Has anyone used Pear: Spreadsheet_Excel_Writer? The Formatting Tutorial lists a script similar to what I'm working with: (trimmed down) <?php require_once 'Spreadsheet/Excel/Writer.php'; $workbook = new Spreadsheet_Excel_Writer(); $worksheet =& $workbook->addWorksheet(); $worksheet->write(0, 0, "Quarterly Profits for Dotcom.Com"); $w...

Richly Formatted excel reports in an ASP.Net application

How do I generate excel reports with rich formatting including charts with a ASP.Net application? As per http://support.microsoft.com/kb/257757 server-side automation of office is advisable and also our admin does not allow installation of office on the server Customer is not ready to spend a lot on 3rd party components A must require...

Excel Timesheet

I have some data in the following format: Salary Code InTime 1690 09:03:00 1690 09:13:00 1690 09:07:00 1691 08:48:00 1691 08:52:00 1691 08:50:00 1691 08:54:00 1691 08:46:00 1691 09:28:00 1691 08:59:00 1691 08:53:00 1691 09:02:00 1693 08:57:00 1693 09:01:00 1693 08:54:00 1693 09:22...

Problem parsing an XLS file with C#

Ok, let's see if I can make this make sense. I have a program written that parses an Excel file and it works just fine. I use the following to get into the file: string FileToConvert = Server.MapPath(".") + "\\App_Data\\CP-ARFJN-FLAG.XLS"; string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileToConvert + ";...

Making Excel functions affect 'other' cells

Let's say that I create a Sub (not a function) whose mission in life is to take the active cell (i.e. Selection) and set an adjacent cell to some value. This works fine. When you try to convert that Sub to a Function and try to evaluate it from from spreadsheet (i.e. setting it's formula to "=MyFunction()") Excel will bark at the fact...

How can I stop Excel 2003 from hanging after opening a spreadsheet in IE?

I have a web application which provides Excel files via IE 7. It requests the files with an HTTP GET from a URL which returns the data with a content type of 'application/vnd.ms-excel'. It then opens the spreadsheets in an IFrame. This all works fine unless Excel is already open when a spreadsheet is downloaded. In this case it is still...

CSV date format [VBA]

Hello I have a VB application which extracts data and creates 3 CSV files (a.csv, b.csv, c.csv). Then I use another Excel spreadsheet (import.xls) to import all the data from the above CSV files into this sheet. import.xls file has a macro which opens the CSV files one by one and copies the data. The problem I am facing is the dates in...

Matching values in two tables query (SQL and Coldfusion question)

I have a query that has a list of base values and a list of language values. Each value has a key that matches to the other. The base values are stored in one table and the language values in another. My problem is that I need to get all matching base values removed from the QUERY except for one. Then I export that query into an exce...

How to check for empty array in vba macro

I want to check for empty arrays. Google gave me varied solutions but nothing worked. Maybe I am not applying them correctly. Function GetBoiler(ByVal sFile As String) As String 'Email Signature Dim fso As Object Dim ts As Object Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.GetFile(sFile).OpenAsTextS...

Exporting dataset to excel error: Exception from HRESULT: 0x800A03EC.

Hi I am having trouble in exporting to excel and it crashes out at the .set_Value function. It seems to work if I change object[,] to string[,] but by doing this I lose the formatting. Anyone Help? ...