excel

Export tables to excel, including a macro

For statistical reasons, I want an extensive analysis from a dataset. I already have a function that exports the data to Excel, but I have raw data that way; 500 lines, 35 columns, heaps of text sometimes... Is it possible to include a macro into a function so that the excelfile is readymade to be analyzed? I am using ASP, Javascript,...

How do I write a DLL for Excel in Delphi?

I'm using Turbo Delphi 2006. The DLL will be called from within Excel as part of a VBA/DLL combination. The first part of the problem is trying to find out how to pass to the DLL a reference to the current Excel session. Most other code I've seen has you launching a separate instance of Excel apart from the one you're in. I've seen s...

last month in VBA Excel

I have a table with a large amount of information, how do i select just the last months worth? (ie just the last 31 cells in the column?) The data is in the form date1 numbers date2 numbers . . . . . . daten numbers where date1 is dd/mm/ccyy cheers ...

Easily using Excel data in SQL Server

I am regularly required to compare data sent to me in Excel spreadsheets with data that lives in SQL Server. I know that you can connect SQL Server to spreadsheets but it always seemed clunky This is really a post to show off my solution but I would love to hear other peoples ideas. ...

Excel VBA Boolean expression order of operations

I have a test in Excel VBA: If (test1) And (test2) And (test3) Then 'do something End If In C, Java, etc. test1 would be run first, then test2, then test3. Critically, if test1 is false the whole test is false so the remaining tests aren't run. Does that happen in this case? If so, which order are the tests running? ...

Need skeleton code to call Excel VBA from PythonWin

I need to invoke a VBA macro within an Excel workbook from a python script. Someone else has provided the Excel workbook with the macro. The macro grabs updated values from an external database, and performs some fairly complex massaging of the data. I need the results from this massaging, and I don't really want to duplicate this in ...

Excel cell formatting by ASP.NET

Hi, I have a problem. One of the datatable colums value is a string value '001200' for example. When the Excel document creats the value became '1200'. How can I keep a data format as is? I'm working with ASP.NET 1.1. The part of the code is: private void lnkExport_Click( object sender, System.EventArgs e ) { Response.Clear(); Respo...

What is a good way to create a variably sized group to be looped over in Excel 2003?

I have a procedure that is run for a lot of items, skipping over certain items who don't meet a criterion. However, I then go back and run it for some of the individuals who were missed in the first pass. I currently do this by manually re-running the procedure for each individual person, but would ideally like a solution a little more...

Exporting crosstab query results to Excel from within MS Access

Hi - I've been trying with limited success to export a crosstab query result set to Excel using Access 2003. Occasionally, the export works correctly, and Excel shows with no errors. Other times, using the exact same query parameters, I get a 3190 error - too many fields. I am using the TransferSpreadsheet option in a macro that is call...

ole excel objects in VB6

Is anyone aware of a good resource online for detailed information on the use of ole excel objects(embeded workbooks, worksheets, etc...) in VB6? I'm maintaining an application that makes heavy use of these conrols and I'm having a lot of trouble getting them to work properly for the user's of this program. The scattered bits of Q&A I ca...

How does the VBA immediate window differ from the application runtime?

I've encountered a very strange bug in VBA and wondered if anyone could shed some light? I'm calling a worksheet function like this: Dim lMyRow As Long lMyRow = WorksheetFunction.Match(vItemID, rngMyRange.Columns(1), 0) This is intended to get the row of the item I pass in. Under certain circumstances (although I can't pin down exa...

How can I perform a reverse string search in Excel without using VBA?

I have an Excel spreadsheet containing a list of strings. Each string is made up of several words, but the number of words in each string is different. Using built in Excel functions (no VBA), is there a way to isolate the last word in each string? Examples: Are you classified as human? -> human? Negative, I am a meat popsicle -> p...

C# interop: excel process not exiting after adding new worksheet to existing file

I've read many of the other threads here about managing COM references while using the .Net-Excel interop to make sure the Excel process exits correctly upon exit, and so far the techniques have been working very well, but I recently came across a problem when adding new worksheets to an existing workbook file. The code below leaves a z...

Excel ODBC and 64 bit server

using ASP.NET I need to update an excel template. Our server is running Windows 2008 in 64 bit mode. I am using the following code to access the excel file: ... string connection = @"Provider=MSDASQL;Driver={Microsoft Excel Driver (*.xls)};DBQ=" + path + ";"; ... IF the application pool is set to Enable 32 bit applicati...

How do I call a VSTO function from a formula in excel?

I'd like to be able to call a function exposed by a VSTO addin from a cell in an excel worksheet. More specifically, if I have a VSTO function Foo() that returns "bar" I'd like to be able to write =Foo() in A1 which evaluates to "bar" on calculation. Is this possible? What are the key steps I'd need to take? The prospect of being able ...

Unable to add reference from COM

I am unable to select Microsoft.Office.Interop.Excel from my window/assembly directory. I can see that one is there but it does not give me the option to reference it. How can i select it? ...

Cannot display measure variance in Excel pivot table

I'm trying to display the difference in a measure from one day to the next in Excel (2007) by setting the value field setting to 'Difference From' with Base field = day and Base item = previous. If my underlying data is a SSAS cube, the value that displays for each cell is #N/A. If my underlying data is a set of records on another worksh...

HTML to Excel: How can tell Excel to treat columns as numbers?

I need to achieve the following when opening an HTML in Excel (Response.contentType="application/vnd.ms-excel") : force Excel to consider content of td cells as numbers make the above so that any subsequent user-entered formulas work on these cells (when the spreadsheet is opened) So far I was successful with adding style="vnd.ms-exc...

Excel Interop - Efficiency and performance

I was wondering what I could do to improve the performance of Excel automation, as it can be quite slow if you have a lot going on in the worksheet... Here's a few I found myself: ExcelApp.ScreenUpdating = false -- turn off the redrawing of the screen ExcelApp.Calculation = Excel.XlCalculation.xlCalculationManual -- turning off the ca...

how do i get a count of columns that contain data from excel

I'm wondering if there is a simple property in the Excel interop that returns the count of used columns--ones containing data--from a given worksheet. In example: If myWorksheet.Columns.Count returns the total number of columns in a given worksheet, is there no equivalent along the lines of: myWorksheet.Columns.UsedCount? I'm not sure ...