excel

What are the differences between using the New keyword and calling CreateObject in Excel VBA?

What criteria should I use to decide whether I write VBA code like this: Set xmlDocument = New MSXML2.DOMDocument or like this: Set xmlDocument = CreateObject("MSXML2.DOMDocument") ? ...

Excel detect inactivity

I want to take an action in an Excel workbook macro after a period of inactivity (hide/protect some worksheets). What is the best/simplest way to achieve this? Í'm assuming I'll use Application.OnTime to periodically check if the user has been active. But what events should I handle to see if the user was "active" (i.e. has does somet...

What's the best .NET library for parsing and generating Excel spreadsheets?

Open-source or not. What's your experience using it? How's the learning curve? ...

Excel 2003 XML format - AutoFitWidth not working

I have a program that spits out an Excel workbook in Excel 2003 XML format. It works fine with one problem, I cannot get the column widths to set automatically. A snippet of what I produce: <Table > <Column ss:AutoFitWidth="1" ss:Width="2"/> <Row ss:AutoFitHeight="0" ss:Height="14.55"> <Cell ss:StyleID="s62"><Data ss:Type=...

Calling .NET COM web service wrapper from Excel

I'm trying to call a web service from Excel 2003 module. The way i've implemented it is creating a .NET COM library with all the classes/methods i need to be exposed. When i try to call a method that queries a web service from Excel the execution just stops on that line without any error. May be it has to do with references? I'm using Mi...

How to automate converting Excel xls files to Excel xml fromat?

I have about 200 Excel files that are in standard Excel 2003 format. I need them all to be saved as Excel xml - basically the same as opening each file and choosing Save As... and then choosing Save as type: XML Spreadsheet Would you know any simple way of automating that task? ...

How do I slice an array in Excel VBA?

What function can I use in Excel VBA to slice an array? ...

learning c# Excel interop

What are some resources that will help get me up and running quickly with the Excel interop in C#? ...

What is the best way to create user help documentation for an Excel VBA solution?

VBA solutions can vary widely in size. I would like to add user help documentation to all solutions but the level of effort to create and deploy the help needs to match the size of the solution. ...

Converting OOo macros to Excel macros

I have an OpenDocument spreadsheet with macros in StarBasic/OOoBasic that I want to convert into an Excel spreadsheet, with the StarBasic macros translated to VBA. While OpenOffice.org claims to have the ability to translate VBA macros to StarBasic and back, my attempts to have OOo convert these original StarBasic macros to VBA have all ...

OnClick in Excel VBA

Apart from being horribly annoyed with Excel VBA ... I have this question: Is there a way to catch a click on a cell in VBA with Excel? I'm not talking about the Worksheet_SelectionChange event, as that won't trigger multiple times if the cell is clicked multiple times. BeforeDoubleClick doesn't solve my problem either, I don't want to ...

Create SQL Table from Excel spreadsheet

Is there an easy way to create a table in SQL Server (2005) from an Excel spreadsheet. I'm thinking maybe some tool? Thanks in advance. ...

How can I make use of .NET objects from within Excel VBA?

Can VBA code instantiate and use .NET objects? The specific class I'm interested in is System.IO.Compression.GZipStream. For Info GAC is the .NET Global Assembly Cache ...

Excel SheetSelectionChange event example needed. C++

I have a problem I'm trying to solve involving interfaceing a C++ program with Excel (an import interface, specifically). The SheetSelectionChange sounds like it will get me most of the way to where I need to be, but I can't find any good documentation or examples on registering the event, using its Range parameter when it's fired, and ...

Excel automation via OLE - suppressing / catching dialog box errors?

I refresh Excel 2007 data connections via a C# program and OLE. Most of the work is done by a single Workbooks.RefreshAll() statement. As is the nature of refreshing spreadsheets, various things can go wrong. During the refresh process, the program can give dialog box error messages about "Data cannot be read from file '|'", and a messa...

How to convert a column number (eg. 127) into an excel column (eg. AA)

How do you convert a numerical number to an Excel column name in C# without using automation getting the value directly from Excel. Excel 2007 has a possible range of 1 to 16384, which is the number of columns that it supports. The resulting values should be in the form of excel column names, e.g. A, AA, AAA etc. ...

Protect Excel Worksheet for format and size and allow only for entry

I am creating an XLS worksheet that would be used to collect data from the users. I have restricted the user input using validations. In order to easily be able to print the worksheet i have set the lenghts of the columns. Have made the relevant columns wrap. However i would like to protect the worksheet such that User is not allowed to ...

WPF ComboBox doesn't stay open when used in a Task Pane

I have a strange bug with WPF Interop and an Excel Addin. I'm using .Net 3.5 SP1. I'm using Add-in Express to create a Custom Task Pane for Excel 2003. Within that taskpane I'm using ElementHost to host a WPF UserControl. The UserControl simply contains a Grid with a TextBox and ComboBox. My problem is that whilst everything displays pr...

Building MFC Automation example (to access Excel using OLE automation). Can't compile

I'm trying to build the example described at http://support.microsoft.com/kb/178749/EN-US/ in order to build an application that programatically accesses Excel using Automation. I have Visual C++ 2005/Visual Studio 2005. Some of the instructions don't exactly match up (classwizard, mostly), but the general idea seems to be the same. ...

How to stop Excel from prompting to reopen a workbook?

I have a readonly Excel workbook containing a VBA application. The application saves any data that needs to be saved in a database, and the workbook is always closed without saving (by setting ThisWorkbook.Saved = True in BeforeClose). I have the following problem: User double-clicks on the workbook in Windows Explorer, workbook open...