excel

How to query excel file in C# using a detailed query

Hi - The following code returns data from a spreadsheet into a grid perfectly [ string excelConnectString = "Provider = Microsoft.Jet.OLEDB.4.0;" + "Data Source = " + excelFileName + ";" + "Extended Properties = Excel 8.0;"; OleDbConnection objConn = new OleDbConnection(excelConnectStr...

Export Multiple Sheets to Excel Through Browser

I need to export multiple data tables to Excel on the clients machine, each to their own sheet. If it was just one sheet, I'd use the Excel/csv content type, but I've heard something about an XML format that can represent an entire workbook. I don't want to go down the Packaging and .xlsx route, so I need standard .xls. Our bug tracke...

Excel VBA to VB.Net

Can anyone please convert this Excel generated VBA code to vb.net? I need to access the Selection.ListObject.QueryTable object in order to preserve the column width. Thanks!! Range("B9").Select() With Selection.ListObject.QueryTable .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = ...

Excel Macro - how to set X axis?

Hi, I have a chart in a Worksheet in Excel and I have a macro set up so that when I change the value in a certain cell the range of data in the chart is set to A2 down as far as the row number corresponding in the this certain cell. What I can't seem to be able to do is to modify the axis as the specified axis no longer covers the rang...

Copy every nth line from one sheet to another

I have an Excel spreadsheet with 1 column, 700 rows. I care about every seventh line. I don't want to have to go in and delete the 6 rows between each row I care about. So my solution was to create another sheet and specify a reference to each cell I want. =sheet1!a1 =sheet1!a8 =sheet1!a15 But I don't want to type in each of these for...

Behaviour of exceptions within delegates in C# 2 hosted by MS Excel and COM

Morning all, Bit of a language theory question here... I've found some references online suggesting that exception handling and delegates in C# have some different behaviour in some cases but I cannot find any concrete documentation on the matter. We recently had some big problems with exceptions inside delegates for a Microsoft Excel ...

How to make a macro which executes periodically in Excel?

How does one execute some VBA code periodically, completely automated? ...

The best 3rd party component for generating Excel spreadsheets from ASP.NET?

I want to generate simple excel spreadsheets with only tabular data that opens in excel when the user clicks a button or a link on a asp.net page. I would like suggestions of good 3rd party components that generates the excel file. A must: native 97-2003 xls files, simple, not expensive. Don't want: office automation, csv/html/text-so...

Is there a way to prevent extra elements in VBA dynamic arrays?

As the title states, is there a way to prevent extra elements from showing up in VBA dynamic arrays when they are non-zero based? For example, when using code similar to the following: While Cells(ndx, 1).Value <> vbNullString ReDim Preserve data(1 To (UBound(data) + 1)) ndx = ndx + 1 Wend You have an extra empty array eleme...

Excel VBA Load Addins

I am trying to create a new instance of Excel using VBA using: Set XlApp = New Excel.Application The problem is that this new instance of Excel doesn't load all the addins that load when I open Excel normally...Is there anything in the Excel Application object for loading in all the user-specified addins? I'm not trying to load a spec...

Relative instead of Absolute paths in Excel VBA

I have written an Excel VBA macro which imports data from a HTML file (stored locally) before performing calculations on the data. At the moment the HTML file is referred to with an absolute path: Workbooks.Open FileName:="C:\Documents and Settings\Senior Caterer\My Documents\Endurance Calculation\TRICATEndurance Summary.html" Howeve...

Help with using TypeConverters for enums in an Excel PIA assembly

I would like to use a TypeCoverter to regionalise output for enums in an assembly that is a PIA loaded into Excel. I can run this and it works on an assembly in a test project I created with an explicitly referenceed assembly, however when running a project that has been built as an Excel PIA. If I try: _ public enum MyEnum ItemA ...

Strings containing double quotes in Excel

How can I construct the following string in an Excel formula: Maurice "The Rocket" Richard If I'm using single quotes, it's trivial = "Maurice 'The Rocket' Richard" but what about double quotes? Thanks ...

Excel Conditional formatting with weighted total

I have sets of values in rows in Excel First row contains weights of how much each value in each column contributes to weighted total. Now, I want to mark in each following row the value that contributed to the weighted total the most, by changing its background. I played with conditional formatting, but my Excel skills are modest, to sa...

How can I access the progress bar in an Office application's status bar.

I build VBA applications for both Word and Excel, is there any way to access the progress bar that sometimes appears in the Office status bar. ...

How can I URL encode a string in Excel VBA?

Is there a built-in way to URL encode a string in Excel VBA or do I need to hand roll this functionality? ...

How to protect image on Excel sheet

I have an Excel worksheet with an image (logo). If I right-click on the picture and select Format Picture / Protection, the "Locked" checkbox is checked. I then protect the worksheet with a password. Despite all of the above, the end user can still select and delete the image. Is there any way to prevent this? Update Indeed Edit Objec...

Creating a new pdf document using AcroEXch in VBScript

Hi I am looking to automate the conversion of an excel sheet into a pdf document (I do not want to manually print the report generated in excel as a pdf document every morning). For now, I would like to create a button in excel that will run the macro to automatically generate the pdf document, but this button will eventually not be us...

Permissions problems with Excel Services in SharePoint

I'm trying to implement an Excel Services reporting solution in SharePoint (MOSS). Since the source data is a SharePoint list, this problem is doubly frustrating. I keep bumping up against permissions problems, even though I've enabled virtually everything in sight. The first error is about refreshing external data - it's not (reall...

Convert time fields to strings in Excel

I have an excel sheet full of times. They are formatted so that they look like: 1:00:15 However if I change the format on the cells to text, they change to the underlying numeric representation of the time: 0.041840278 How can I convert the cells to be text cells but still have the time in them ? ...