Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default .NET code hangs setting up a chart

I have some .NET code that opens an excel spreadsheet, dumps some data into
it, and then makes a chart. The problem is that once the data becomes so
big, the system seems to hang. The routine invovled looks like this:

Private Sub CreateExcelChart(ByVal xl As Excel.Application, ByVal wb As
Excel.Workbook, ByVal xlRow As Integer, ByVal xlFirstCol As Integer, ByVal
xlLastCol As Integer)
Dim sheetData As Excel.Worksheet = wb.Sheets("ChartData")

Select Case Me.ExcelGraphType
Case OLAPGridExcelGraphType.BarGraph
'This code branch is not the issue
Case OLAPGridExcelGraphType.LineGraph
'This one is
sheetData.Range(sheetData.Cells(2, 1),
sheetData.Cells(xlRow - 2, xlLastCol)).Select()
wb.Charts.Add()
wb.ActiveChart.ChartType = Excel.XlChartType.xlLineMarkers
wb.ActiveChart.PlotBy = Excel.XlRowCol.xlRows

<<<<<<< THIS IS WHERE I HANG

Dim s As Excel.Series
For Each s In wb.ActiveChart.SeriesCollection
s.XValues = "=ChartData!R1C" & xlFirstCol & ":R2C" &
xlLastCol
Next
End Select

wb.ActiveChart.Move(After:=wb.Sheets(2))
End Sub

Has anyone seen this? Thanks,
Chris Magoun


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default .NET code hangs setting up a chart

I see the problem now. The plotBy = Rows can only take up to 255 rows or
else it chokes and throws a dialog, which is hanging the system.

Chris


"Chris Magoun" wrote in message
...
I have some .NET code that opens an excel spreadsheet, dumps some data into
it, and then makes a chart. The problem is that once the data becomes so
big, the system seems to hang. The routine invovled looks like this:

Private Sub CreateExcelChart(ByVal xl As Excel.Application, ByVal wb As
Excel.Workbook, ByVal xlRow As Integer, ByVal xlFirstCol As Integer, ByVal
xlLastCol As Integer)
Dim sheetData As Excel.Worksheet = wb.Sheets("ChartData")

Select Case Me.ExcelGraphType
Case OLAPGridExcelGraphType.BarGraph
'This code branch is not the issue
Case OLAPGridExcelGraphType.LineGraph
'This one is
sheetData.Range(sheetData.Cells(2, 1),
sheetData.Cells(xlRow - 2, xlLastCol)).Select()
wb.Charts.Add()
wb.ActiveChart.ChartType = Excel.XlChartType.xlLineMarkers
wb.ActiveChart.PlotBy = Excel.XlRowCol.xlRows

<<<<<<< THIS IS WHERE I HANG

Dim s As Excel.Series
For Each s In wb.ActiveChart.SeriesCollection
s.XValues = "=ChartData!R1C" & xlFirstCol & ":R2C" &
xlLastCol
Next
End Select

wb.ActiveChart.Move(After:=wb.Sheets(2))
End Sub

Has anyone seen this? Thanks,
Chris Magoun



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 hangs while loading chart Gerry Verschuuren Charts and Charting in Excel 0 July 17th 09 08:05 PM
Setting Chart MajorUnit for Clean lookng Chart JbL Excel Programming 1 February 24th 05 07:44 AM
Code hangs Excel ... Why? ... and how can i debug?? Simon May Excel Programming 1 January 17th 05 06:22 AM
vc++ automation: opening chart as chart window and setting scale Mike Biolsi Excel Programming 0 February 7th 04 08:13 AM
Chart.Export creates zero byte GIF and hangs on server AB[_3_] Excel Programming 4 December 22nd 03 06:20 PM


All times are GMT +1. The time now is 05:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"