excel

IFDEF equivalent in VBA

I have code that needs to run on both Excel 2003 and Excel 2007, and there are a few spots where changes in the versions cause the code to halt. I tried separating these lines out with If-Else statements, but the code won't compile on either because it doesn't recognize the code used for the other. Is there any way I could tell one ver...

Maintaining Customer Data

All our applications rely on a certain amount of client data i.e. Lookups for comboboxes, users, roles, user-roles... We currently use a spreadsheet to map the data and generate insert scripts that are then imported into SQL server. The has seemed to work for us but it is very difficult to update and maintain when there are a lot of ch...

Retain cell address when sorting list

Here is a reduced version of what I need. Essentially, we have a list of components and their status (imagine they have been tested). Component BBB has two sub-components, BBB1 and BBB2. I want their status to reflect that of the BBB component 'parent'. Easily done, apart from the list is very long, and I need to retain the option to sor...

Create a SQL Table from Excel VBA

The problem is that I cannot get the table name that was entered into the variable, "tblName", to be used instead I get a correctly named database with a table named "tblName". Is there some way to pick up the name in "tblName" or some way to change the name once it is created with a name th user enters? Private Sub CreateDatabaseFrom...

XSLT - XML to XLS

I have an XSLT template that gets applied to an XML file of data. The template generates an Excel Spreadsheet XML file. Everything works wonderful except for one minor issue.... When I open the spreadsheet in Excel, it treats it as an XML import and asks me whether the stylesheet should be applied. I would like to have it so it autom...

How do I get rid of the "cannot empty the clipboard" error?

Right now, I'm getting it in Excel 2007, but I've gotten the same error in pretty much every version of Excel I've used since 97. The only discernable similarity is that happens on my office PC. It's never bothered me on my home PC. In Excel 2003, I was able to mess around in the clipboard options until it went away. In 2007, though,...

What text format can I use to present data originally in an Excel spreadsheet?

I have an Excel spreadsheet that has many people's estimates of another person's height and weight. In addition, some people have left comments on both estimate cells like "This estimate takes into account such and such". I want to take the data from the spreadsheet (I've already figured out how to parse it), and represent it in a plain...

Linking MS Excel to MS Access queries

I have an Access database that I use to to run a bunch of aggregate TOP 5 queries. The end game of this particular function is ppt presentations with charts. So to automate this a bit, I created an excel spreadsheet with a bunch of pre-made charts in it. The I linked/data imported the query results into the excel spreadsheet, and set the...

Excel hangs when printing the first time from ASP.NET webservice

We are using Excel to convert SpreatSheetML to XLS in an ASP.NET webservice. Moreover, if the user checks the right checkboxes, we spawn a thread that uses Excel to print the spreadsheet. Recently, we have deployed the app in a new environment, and then we started having problems: the first time someone tries to print, Excel seems to h...

ASP.NET manuplating Excel sheet

I need to manuplate an excel sheet workbook (add sheets/ add data/ hide columns / protect cells with password / change fields contents/ etc etc) should I use the COM objects provided by microsoft (but then i think they have few problems being used in asp.NET) or is there a good (commurcial or free) library / plug in to be used for doin...

Return value of last match

I need a formula to return the value of Data for the last match of "Text". Row number is also acceptable. Macro is NOT acceptable. Name column is unsorted and cannot be sorted! Only column "Name" is used as lookup value. I would rather use a/multiple helper column(s) instead of an array formula. Row Name Data 1 Joe 10 2 Tom 20 3 ...

Multiple Pivot Charts SetSourceData Error

I have multiple pivot charts each with their own pivot table on separate worksheets in Excel 2002. When I try to generate these charts with VBA with the following code: Set cht = Charts.Add(After:=Worksheets("Setup")) With cht ' we use named ranges here .SetSourceData Source:=range(tblName) .Name = chtName .... where tb...

Default value for PivotChart Report Filter/Page Field

I'm generating a pivot chart in Excel 2002 with a macro, using a date field as the chart report filter (setting the field orientation to xlPageField). I would like to set the default selected value of this pivotfield to the most recent value in the date field. What's the right syntax for doing that in VBA? ...

Embedding an Excel pivot table into C# winforms

Hi, Does anyone know how I can embed an Excel Pivot table control in a win form application developed in C#? The raw data for the form would be coming from a SQL Server 2000 database and loaded into a DataTable. Thanks, ...

Export DataSet to Excel ASP.Net

I need to Export DataSet to Excel, Exporting it is not the main issue, When I am using the Same Exported Excel File using following Connection String CS = "provider=Microsoft.Jet.OLEDB.4.0; " & _ "data source=" + FilePath + ";Extended Properties=Excel 8.0;" It gives me an error message saying External Table is not i...

How to get a DateDiff-Value in milliseconds in VBA (Excel) ?

I need to calculate the difference between two timestamps in milliseconds. Unfortunatley, the DateDiff-function of VBA does not offer this precision. Are there any workarounds? Thanks in advance! ...

Is it ever a good idea to store BLOBs in a database?

For a while I've been working on inserting the data from a bloated Excel workbook into a SQL database. My team has suggested keeping a backup of the .xls, and they are wondering if it might be a good idea to put the Excel workbook actually inside the database so that all the relevant data from our project was together. I know some datab...

How to suppress the file corrupt warning at excel download?

I have a web page which links to an excel 2007 worksheet. It is a .xls file and not .xlsx file. When I click on the link I get the usual dialog box to either open/save the excel file. On clicking 'Open', I get the following warning message- The file you are trying to open, 'filename.xls' is in a different format than specified by...

How can I activate an Excel add-in from Perl or the command line?

(Please forgive my ignorance on Excel add-ins, and feel free to correct my teminology where appropriate.) I have an Excel add-in that is used regularly. This add-in inserts a toolbar with a number of buttons. I want to automate the task of opening a spreadsheet in Excel and then "clicking" one of those buttons. In other words, I want...

How to get the process ID of the current Excel, throught VBA, without relying on finding the window by the caption?

How can I get the process ID of the current Excel instance, that my VBA code is running in, without asking for it by the name in the caption... which causes a problem when I have two or more Excel instances with the same caption? ...