ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with managing excel embedded with IFRAME (https://www.excelbanter.com/excel-programming/372380-problem-managing-excel-embedded-iframe.html)

news://news.microsoft.com

Problem with managing excel embedded with IFRAME
 
Hello

I have a problem with embeddeing excel in iframe:

<IFRAME src="1.xls"

and this works fine. Then on client side in browser i try to do some
action with that workbookfrom javascript. The problem is, that when i
get the excel object and get ActiveWorkbook - i have my workbook,
BUT ONLY FOR FIRST OPERATION!! Example:

function setCellContent()
{
var objExcel = GetObject("","Excel.Application");

// Here is ok, alert says '1.xls'
alert("Window: " + objExcel.ActiveWorkbook.Name);

// But here it is no ok! Excel changed Active workbook
// for some other by itself...
alert("Window: " + objExcel.ActiveWorkbook.Name);
}

OK, my workbook is still in the IFRAME, i can see it, so i will try to
get it this way:

I'm looking for my '1.xls' :

alert("Window: " + objExcel.ActiveWindow.Caption);
objExcel.ActiveWindow.ActivateNext();
alert("Window: " + objExcel.ActiveWindow.Caption);
objExcel.ActiveWindow.ActivateNext();
alert("Window: " + objExcel.ActiveWindow.Caption);
objExcel.ActiveWindow.ActivateNext();
.....

There isn't !! It is imposible to set my workbook active, so
i can't do anything with it!

And i still can see it by doing this:

for (var i=1;i<=objExcel.Workbooks.Count;i++)
{
if (objExcel.Workbooks(i).Name == "1.xls")
{
alert("There it is: " + i + " " + objExcel.Workbooks(i).Name);
}
}

What is going on, please help.

Best reagards,
Michal Dabrowski


Michal[_2_]

Problem with managing excel embedded with IFRAME
 
That's me again.

Can anyone tell me anything abot my problem please?

What I can add is that Activate() method doesn't work neither. Example:

for (var i=1;i<=objExcel.Workbooks.Count;i++)
{
if (objExcel.Workbooks(i).Name == "1.xls")
{
alert("There it is: " + i + " " + objExcel.Workbooks(i).Name);
objExcel.Workbooks(i).Activate();
}
}

alert(objExcel.ActiveWorkbook.Name); // doesn't get '1.xls' ,
// but somthing else
// or nothing

Thanks for any help in advance
Michal Dabrowski


All times are GMT +1. The time now is 01:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com