excel

Keep formatting on an excel cell

Basically I would like to keep the existing format of an Excel cell. If I use ActiveCell.Value2 = "new value"; The ActiveCell displays "new value" but loses the user defined formatting ( say red font, blue background), all formatting values goes back to Excel default format values. Note: If you replace a cell value using Excel, Excel k...

Packaging an excel addin

I have an automation addin for excel developed using C#. How do I package and distribute it ? Also when the addin is installed for the first time, I want a username and password check to pop for the first time. How can I go about doing this ? thanks ...

convert excel to pdf in python

Is there a good python module to convert .xls file to PDF? ...

Changing the Pivot Cache works fine except when 2nd pivot table is added

Hi, Using Code to change the pivot cache of the pivottable specifically: Dim pc As PivotCache, pt As PivotTable Set pt = Sheets("Sheet1").PivotTables("PivotTable1") Set pc = pt.PivotCache With pc .CommandType = xlCmdSql .CommandText = "Select * From Query1 Where Query1.Date BETWEEN #" & startval & "# AND #" & endval & "#" .Refres...

Creating add-in for Excel using C#.

I want to use C# class methods in Excel. Can anybody guid me how to do it ? The C# component will be excel add-in. How to create setup for this addin, so that I just need to give setup to user which will install add-in at client's machine. User should not need to do any other steps like registering the C# dll. Thanks in Advance. -- Rob...

Tracking Excel files in Version Control

We are branching out beyond the development team and trying to get other groups within my company to use version control for important documents that need change tracking. One frequent need is for Excel spreadsheets. These are large spreadsheets, modified fairly frequently (weekly or monthly) but with only a small portion of the cells ch...

How can I create a table readable in excel? C#

I have some data in c#, and I want to put this data into Excel. I figure the easiest way is to export it as XML since Excel reads xml files. What's the easiest way to do this? I don't know what format the xml needs to be in for Excel to read it. I want a simple table of data (headers, data, and totals, although the totals I can simply g...

CSV files and multi line text cells

Hi, I am generating a simple csv file using php. The file contains some user's personal data. When I open the generated file in office, the addresses are not displayed in full height. I have to double click on the cell for the address to be shown fully (in full width and height) otherwise I can only see the first word/number of the addre...

Excel commands not available when macro is paused

In Excel 2003, I was able to pause a macro switch to Excel and perform excel functions, then switch back to VB and resume the macro. In Excel 2007 when I pause a macro and switch to excel, most of the excel functionality does not respond. I can switch between sheets and perform 'browse' type functions, but I cannot change cell values or...

Excel VBA WinHttp How to submit a form

I'm using WinHttp to access an URL, say "http://server/application?id=abc" When I try to URL from Explorer, I get an HTML table with lots of info. However when I try from Excel VBA like this: ht.Open "POST", "http://server/application?id=abc", False ht.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" ...

How to find the X and Y co-ordinates of points on an Excel scatter plot

I've got a scatter plot which I generate and set the data for programatically. The only problem is that if the data series are close together the labels find themselves right on top of each other. I have an algorithm in mind for moving the labels around so they remain close to their corresponding data series and are positioned so that t...

How to add Excel sheet to C# console application

hi Can any one explain the process of adding excel file in c sharp... and What are the requirements for that..and IS it necessary to install MS Excel in the system for using of Excel in C sharp ...

Using NOT LIKE in Filter property of VBA recordset

I am using excel 2003 to connect to SYBASE database using VBA recordset. I want to filter the records. Following is code I have used. Dim rset As New ADODB.Recordset rset.Open sQuery, m_db, adOpenForwardOnly rset.Filter = "Name NOT LIKE 'Dav%'" rset.Requery But it is not working and returning all rows. If I use Name LIKE 'Dav%', its ...

Merge columns in Excel using Visual c++

I would like to know how can we merge any two colums(cells) and have text on the merged columns in MS Excel programmatically using C++. We are using Microsoft Visual Studio 2008. The function we use for Excel operations is Autowrap();, e.g.: AutoWrap(DISPATCH_PROPERTYGET, &result, pXlSheet, L"Range", 1, parm); in place of range I tr...

Add a cell formula in Excel via vba

Hello, I’m not an Excel or VBA expert but I want to insert this current excel formula into cell’s using VBA. Current Excel formula: =IF(OR(ISNUM(D570)=FALSE;ISNUM(D573)=FALSE);"";IF(C573="Total";D573-D570;"")) VBA formula : ActiveSheet.Range("a" & ActiveSheet.Rows.Count).End(xlUp).Offset(2, 12).Value = "=IF(OR(ISNUM(R[-3]C[-9]...

Excel VBA development best practises

We are an ISV with experience developing and distributing desktop applications written in VB6. We are now developing tools as Excel spreadsheets containing VBA code. These will be downloadable free for various users including local government organisations. We've rarely distributed spreadsheets outside our own organisation before. What...

Excel Sum Based on Several Criteria

A B C 1 10/1/2009 3652449 12:15:43 AM 2 10/1/2009 3652449 12:17:03 AM 3 10/4/2009 3652449 1:03:08 AM Hello, I want to sum the total time of the card 3652449 just for 10/1/2009. Then after the sum is compete I need the time to be converted and rounded into minutes only. I have been using the following...

Windows Service hangs when opening OLEDB-connection to Excel-file

I have a Windows Service that hangs when opening an OLEDB-connection to an Excel-file, like this: using (var connection = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0\"")) { connection.Open(); // start using the connection } This code works fine when r...

Excel Overtime Calculation

I need to calculate the number of hours and mins I have gone over 1 hour/60 mins. So if I did 1 hour and 6 mins of something and i write that in one cell (E9) I want the other cell (G9) to show 6 mins. So it shows I did 6 mins over the required 1 hour. If I did 2 hours and 40 mins (E9) I want the cell (G9) to show 1 hour and 40 mins. ...

Is there a way to use OLE DB Provider for Jet on an unsaved Excel workbook?

I am working with the Microsoft OLE DB Provider for Jet to execute queries on spreadsheets in Excel using VBA. Is there a way to execute the following code on an unsaved workbook? For example, ActiveWorkbook.FullName returns "Book1" if the workbook has never been saved. In that case the Data Source will assume the path is the active dir...