excel

How to programmatically set every other column in a worksheet in Interop

Using Excel Interop (.NET) how can we set programmatically two different Excel formulas for every other column. For instance, Range r = _sheet.get_Range(_sheet.Cells[1, 1], _sheet.Cells[I, J]) r.Formula = "=something1" will do it for every cell. But within J columns every other column has to have formula "=something2". The size ...

How to create a copy of a file having length more than 260 characters.

How to create a copy of a file having length more than 260 characters including file name using vb.net When we are trying to create a copy using File.Copy method it throws exception as follows: "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name mu...

Format cell color based on value in another sheet and cell

Howdy, I have a workbook with two sheets. I would like to format the cell background color in the first column of sheet 1 based on the values in the second column of sheet 2. For example, if the value of of sheet2, row 6, column 2 is say, 4, then I would like the background color of sheet 1, row 4, column 1 to be green. If none of the ...

Valid characters for Excel sheet names

In Java, we're using the following package to programmatically create excel documents: org.apache.poi.hssf If you attempt to set a sheet's name (NOT file, but internal Excel sheet), you will get an error if: The name is over 31 characters The name contains any of the following characters: / \ * ? [ ] However, after creating a docu...

What's the best way to export UTF8 data into Excel?

So we have this web app where we support UTF8 data. Hooray UTF8. And we can export the user-supplied data into CSV no problem - it's still in UTF8 at that point. The problem is when you open a typical UTF8 CSV up in Excel, it reads it as ANSII encoded text, and accordingly tries to read two-byte chars like ø and ü as two separate charact...

How can I start a specific excel version in com automation?

I use Excel via COM automation (in c#), but it seems that the problem has no control over what version of excel is started on the box - we use both Excel 9 and Excel 11 and one specific set of spreadsheets requires excel 9 else they wont work. I included the excel 9 com references but on another persons machine excel 11 started. How can...

Can an Excel Data Connection lock a DB table?

Hi, If I add a simple Sql Server table data connection to an Excel worksheet, can it lock that table if the connection is never closed? ...

Programmatically copy a cell from Excel using VC++

Without: MFC ATL using COM, with pure C++, steps taken thus far: //steps above omitted _ApplicationPtr application(__uuidof(Excel::Application)); //omitted const BSTR wcharFileName = SysAllocString(L"..."); application->Workbooks->Open(wcharFileName); application->put_Visible(10, true); Question: How to then copy a cell, fo...

Any jsp tag library to perform simple excel editing?

Hi all, Is there any jsp tag library that can perform simple excel editing on web? ...

C# 2.0 Fastest way to parse Excel spreadsheet

What is the fastest way to read large sets of data from excel from Csharp. Example code would be great . . ...

What options do I have for reading Excel files and evaluating formulas in C#, Java and PHP?

I've seen various means of reading (and writing) Excel spreadsheets. For example: In .Net as an ADO.Net source (as per Reading Excel files from C#); In Java with either JExcelAPI ("jxl") or Apache POI; In PHP with the Excel Spreadsheet Writer (as per Format text in Excel file via PHP and PHP:Writing to excel file using PEAR). But I'...

Problems with Excel automation in PowerShell

Hi fellows, I’m trying to automate the refreshing of data in my Excel Reports. Here the script: $ExcelApp = new-object -ComObject Excel.Application $ExcelApp.Visible = $false $ExcelApp.DisplayAlerts = $false $Workbook = $ExcelApp.Workbooks.Open("RefreshTest.xlsx", 3, $false, 5, $null, $null, $true) $Workbook.RefreshAll() $Workbook.Sav...

Excel: how to create a number in a column according to a text value in other column?

I have a text column with repeated values, for example: | A | ---|---------| 1 | emails | 2 | foo | 3 | foo | 4 | bar | 5 | bar | 6 | stuff | 7 | stuff | 8 | stuff | What I would like to do is to have another column with numbers, so that each number matches the value in the first column, for ex...

How do I copy a range into a temp workbook and return a reference to it with a vba function?

I have the following which errors on the "rTemp.Value = vaTemp" line. What am I doing wrong here? Am I on the right track? Function CreateTempRange(rSource As range) As range ' Declarations Dim rTemp As range Dim vaTemp As Variant Dim wsTemp As Worksheet Dim wbTemp As Workbook ' Open temp worksheet Set wbTem...

Select a Node in a TreeView with VBA

I have a TreeView within a UserForm in Excel. When a Node is selected from the TreeView, a ListBox is populated with data. When an item in the ListBox is double-clicked, a separate UserForm is shown which allows the user do to stuff. Once the user returns back to the TreeView UserForm, I want the Node that was selected previously to be h...

automate excel file processing in perl and avoid dialog/UI interactions

How can a I guarantee that no pop-up dialogs will appear when I automate Microsoft Excel through OLE? I'm using a Perl module (Win32::OLE). I can avoid most dialog pop-ups using the following code: use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::Const; my $excel_symbols = Win32::OLE::Const->Load('Microsoft Excel'); my $excel =...

How do I copy a range in vba?

I'm trying this but its giving me a type-mismatch. Is there another way to do this? I'm assuming rSource is not coming from the active sheet. Also, I only need values. Edit: The rSource is expected to have rows and columns. It will also be a single continuous area. Edit: Once this operation is complete I should be able to filter each ...

.Net Excel Add In Help

Hello, I am interested in creating a couple of add-ins for Office 2003 & 2007 for work and home. I see the project templates in VS2008 for creating the addins but I am un-clear as to what to do next. I also have had great difficulty finding direction online so far. I am not looking for cut and paste code but rather a finger pointing...

Why is this file always saved as FALSE.xls ?

Hello! I wrote a VB script that creates an .xls file, based on .xlt file. Then it calls a macro from the .xls file that populates it with information from a database. In the last step the script saves the .xls file on the disk. I did this before with VB and Excel 2003. Now I upgraded to Excel 2007 and before it saves the file, a windo...

Workaround to see if Excel is in cell-edit mode in .NET

I have an application written in VB.NET that interacts with Excel via interop. I eventually ran into the known issue of Cell-edit mode (see MSDN and stackoverflow for some background). I have been trying to convert the suggested code to VB.NET but keep getting the following error: Reference required to assembly 'office, Version=11.0....