Hi There I have a script that takes a MS Access database and places a table into an Excel spreadsheet. Once the data is in Excel I want to generate a graph.
All goes well in that the graph is generated, using the correct data and style, the graph title but the “PlotBy => xlColumns” is not honored. Rather the graph is picking up the default of rows !! Can anyone advise why this might me so ? Regards Mark Extract of script…. use Win32::ODBC; use Win32::OLE qw(with); use Win32::OLE::Const; use Win32::OLE::Const 'Microsoft Excel'; # # Change the format of the cells to get the correct date format # $sheet->Cells(1,1)->{Value} = " " ; $sheet->Range("B1:" . chr(65+$numCols) . "1")->{NumberFormat} = "mmm" ; # # This next section will graph the results # $ChartCells = "A1:" . chr(65+$numCols) . ($rowCounter-1) ; my $Range = $xl_app->ActiveSheet->Range($ChartCells)->Select; $Chart = $xl_app->Charts->Add ; $Chart->{ChartType} = xlColumnStacked ; $Chart->SetSourceData({Source => $Range, PlotBy => xlColumns}) ; $Chart->Location({Where=>xlLocationAsNewSheet, Name=>"My Graph Title"}) ; # # On our way out save the Excel file and close the database # $db->Close(); $book->SaveAs( 'C:\\perlSrc\\test1.xls' ); undef $book; undef $xl_app;