Automating from javascript - can't get Excel window to front
I 've written some Javascript code to export a bunch of data to a an
Excel worksheet Everything works exactly as I would like, except that the Excel window is not opening in front of the browser window; the Excel window appears on the taskbar, blinking, and I need to click it to bring it to the front. Here is my code; what am I missing? function ExportExcel() { // Open Excel and export the view data to it var oXL = new ActiveXObject("Excel.Application"); oXL.Visible = true; var oWB = oXL.Workbooks.Add(); var oSheet = oWB.ActiveSheet; // Put the data on the sheet var RangeStart = 'A2'; var RangeEnd = 'E500'; var RangeText = RangeStart + ':' + RangeEnd; var oRange = oSheet.Range(RangeText) // GetExcelArray() simply returns the data oRange.Value = GetExcelArray(); oXL.Visible = true; oXL.UserControl = true; } |
All times are GMT +1. The time now is 03:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com