Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2000 Crashes On Close After VFP Creates Chart In Workbook

Status
Not open for further replies.

mdav2

Programmer
Aug 22, 2000
363
GB
Very wierd one here. I have the standard create spreadsheet code which works fine in Excel 2000 and 2003. In my VFP code I have the option of creating a simple chart using code below

Code:
		oexcel.Sheets("Score Counts").SELECT
		oexcel.Charts.ADD
		oexcel.ActiveChart.ChartType = xlBarClustered
		oexcel.ActiveChart.SetSourceData(oworkbook.worksheets(1).RANGE(lcRange), xlRows)
		oexcel.ActiveChart.Location(xlLocationAsNewSheet, "Q" + ALLTRIM(STR(ROUND(lnQuestion,0))) + "-Chart" )
		oexcel.ActiveChart.HasTitle = .T.
		oexcel.ActiveChart.HasLegend = .F.
		oexcel.ActiveChart.ChartTitle.Characters.TEXT = lcChartTitle
		oexcel.ActiveChart.Axes(xlValue, xlPrimary).HasTitle = .T.
		oexcel.ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Characters.TEXT = "Frequency"

Whenever I create a chart and the user closes the workbook Excel errors and closes. If I don't create a chart it doesn't. The other thing is the error only happens in excel 2000 and not 2003.

My easy solution is put all 2000 users onto 2003 but it would be useful to know if anyone else has experienced this and knows why it happens.

Mark Davies
Warwickshire County Council
 
Are you releasing the object reference? It SHOULDN'T make a difference, but various versions of this and that have been funky about mismatched reference counts over the years.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top