This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > FrontPage Programming > March 2007 > Opening .xls in Excel, not IE





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Opening .xls in Excel, not IE
Cranky

2007-03-20, 7:16 pm

Hi

I'm not sure if I should be asking here, or in an Excel group.

I have several .xls files for recording office data on an intranet,
and have been recently using FP to put together a page for linking
them together. When I click, on, say "April", the April spreadsheet
opens in Explorer.

Is there any way of opening the .xls file in Excel when I click on the
IE hyperlink?

Thanks in advance

S:)

2DC

2007-03-20, 7:16 pm

Cranky:

There are a couple of options to consider. If you are passing the name of
the Excel spreadsheet as a parameter to a URL, use the following code:

// Define a new array to hold the parameters passed on the request
var qsParm = new Array();
var objExcel;
var strLocation;
/* Search through the URL and get the parameter key and the parameter value
and load them into the array */
function parseParameters() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = val;
}
}
}


function OpenWorkbook(strLocation){
objExcel = new ActiveXObject("Excel.Application");
objExcel.Visible = true;
objExcel.Workbooks.Open(strLocation);
objExcel.UserControl = true;
}
// Envoke the function to parse the URL parameters
parseParameters();
/* Based on the report name passed in the URL, open a new Excel session
with the requested spreadsheet */
OpenWorkbook(qsParm['workbook']);
history.back();


If you want to open the file directly from within a page, try this:

var objExcel;
var strLocation;

function OpenWorkbook(strLocation){
objExcel = new ActiveXObject("Excel.Application");
objExcel.Visible = true;
objExcel.Workbooks.Open(strLocation);
objExcel.UserControl = true;
}

Regards . . ..

"Cranky" wrote:

> Hi
>
> I'm not sure if I should be asking here, or in an Excel group.
>
> I have several .xls files for recording office data on an intranet,
> and have been recently using FP to put together a page for linking
> them together. When I click, on, say "April", the April spreadsheet
> opens in Explorer.
>
> Is there any way of opening the .xls file in Excel when I click on the
> IE hyperlink?
>
> Thanks in advance
>
> S:)
>
>

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews