Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel in IE - opening new window
We create binary XLS files(using the MS Excel BIFF8
specification) for our content. Our users can access these XLS files on our web site via HTTP requests. Upon request, IE opens an instance of Excel in the browser window and displays the XLS file. There are links in the spreadsheet to "source data"(HTML files). We want to encode these HTTP links within the binary XLS file so users can view the "source data" (HTML). Currently, when you click on one of these links, the HTML file opens in the same browser window. We are trying to open the HTML file in a NEW browser window and give it focus. This way, our users can view the XLS file and HTML file(source document) side-by-side. Here's what we tried so far. All attempts have been unsuccessful. Using the Script Editor in Excel, we created an <a tag around the link text and added the target="_blank" attribute. Excel seemed to ignore this. Next, we tried using the JavaScript window.open method in the HREF. This method spawned a new window for our HTML file, but the existing browser window that contained the XLS file became blank, well, actually contained "[object]". It seemed like Excel populated the new URL,"javascript:window.open('http://...)", in this window instead of retaining the existing XLS file. Next, we added document.location.href='{entered path to XLS file}' to the HREF, and this almost worked. A new browser window successfully opened with our HTML file, and our original browser window "reloaded" the XLS file. The problem was that upon this "reload", we got the Excel "File Download" dialog box telling us that these files could be harmful and asking if we wanted to open it, save it, ... We click Open and everything works fine, but the XLS file has focus now, instead of the HTML file. Although both windows are open, you can't easily tell that the HTML file has been opened. We tried to change focus by adding some JavaScript to the <body tag of the XLS file, but that didn't work either. Finally, I found this on MSDN. This is exactly the problem we're seeing but both solutions failed to work for us. http://support.microsoft.com/default.aspx?scid=kb;en- us;257321 Any help on this matter would be greatly appreciated. Chris Marino Senior Web Developer Edgar Online, Inc. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel in IE - opening new window
Hi Chris,
Unless you're saving as HTML, I think you're correct in that Excel will ignore the new window requests. If you put in the target="_blank" and save as HTML, then it will work as expected. But I'm guessing you need to serve the files in XLS format. The only way I could get this to work is to use the Worksheet_FollowHyperlink event. Basically, you would add the hyperlink to the worksheet, but make it hyperlink to itself (the cell the hyperlink is in), which effectively makes it go nowhere. The TextToDisplay property would be used to specify the URL for the link. Then, in the FollowHyperlink event, you could do something like this: Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) ThisWorkbook.FollowHyperlink Target.TextToDisplay, , True End Sub The drawback to this method is that the macro security dialog will pop up since you have added VBA code. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Chris Marino wrote: We create binary XLS files(using the MS Excel BIFF8 specification) for our content. Our users can access these XLS files on our web site via HTTP requests. Upon request, IE opens an instance of Excel in the browser window and displays the XLS file. There are links in the spreadsheet to "source data"(HTML files). We want to encode these HTTP links within the binary XLS file so users can view the "source data" (HTML). Currently, when you click on one of these links, the HTML file opens in the same browser window. We are trying to open the HTML file in a NEW browser window and give it focus. This way, our users can view the XLS file and HTML file(source document) side-by-side. Here's what we tried so far. All attempts have been unsuccessful. Using the Script Editor in Excel, we created an <a tag around the link text and added the target="_blank" attribute. Excel seemed to ignore this. Next, we tried using the JavaScript window.open method in the HREF. This method spawned a new window for our HTML file, but the existing browser window that contained the XLS file became blank, well, actually contained "[object]". It seemed like Excel populated the new URL,"javascript:window.open('http://...)", in this window instead of retaining the existing XLS file. Next, we added document.location.href='{entered path to XLS file}' to the HREF, and this almost worked. A new browser window successfully opened with our HTML file, and our original browser window "reloaded" the XLS file. The problem was that upon this "reload", we got the Excel "File Download" dialog box telling us that these files could be harmful and asking if we wanted to open it, save it, ... We click Open and everything works fine, but the XLS file has focus now, instead of the HTML file. Although both windows are open, you can't easily tell that the HTML file has been opened. We tried to change focus by adding some JavaScript to the <body tag of the XLS file, but that didn't work either. Finally, I found this on MSDN. This is exactly the problem we're seeing but both solutions failed to work for us. http://support.microsoft.com/default.aspx?scid=kb;en- us;257321 Any help on this matter would be greatly appreciated. Chris Marino Senior Web Developer Edgar Online, Inc. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Opening Excel sheet in its own window | Setting up and Configuration of Excel | |||
Opening an Excel link in new window | Excel Discussion (Misc queries) | |||
opening excel docs in a new window | Excel Discussion (Misc queries) | |||
Opening excel in a new window | Excel Discussion (Misc queries) | |||
Opening excel file in new window | Excel Discussion (Misc queries) |