Insert range in Excel

From: Date: Fri, 14 Jan 2005 13:33:39 +0000
Subject: Insert range in Excel
Groups: php.windows 
Request: Send a blank email to php-windows+get-25328@lists.php.net to get a copy of this message
Hi guys I managed to get this far with my Excel spreadsheet: // Set the workbook to use and it's sheet $workbook=$_GLOBALS["templatedir"]."\ElectricityTransactions.XLT"; $sheet="Sheet1"; //Instantiate the spreadsheet component. $ex = new COM("Excel.sheet") or Die ("Did not connect"); //Open the workbook that we want to use. $wkb = $ex->application->Workbooks->Open($workbook) or Die ("Did not open"); //Create a copy of the workbook, so the original workbook will be preserved. $ex->Application->ActiveWorkbook->SaveAs($_GLOBALS["reportdir"]."\rpt_electrans_".trim($Outlet_session).".xls"); //$ex->Application->Visible = 1; #Uncomment to make Excel visible. //Read and write to a cells in the sheet $sheets = $wkb->Worksheets($sheet); //Select the sheet $sheets->activate; //Activate it $cell = $sheets->Cells(1,2) ; //Select the cell (Row Column number) $cell->activate; //Activate the cell $cell->value = "ELECTRICITY TRANSACTIONS Outlet ".trim($Outlet_session); //Change it But now how would I insert a range i.e., simulate in Excel the following: Select range B8:H8. Right click and select insert. Any ideas? Cheers Louis

« previous php.windows (#25328) next »