LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Apparent Excel 2007 chart HasTitle race condition

The macro below works correctly, i.e. creates a chart without a title, with
Excel 2003, but the chart has a title with Excel 2007 SP2 and the Excel 2010
beta. (The macro requires numeric data in the range A1:B10 on the first
worksheet.)

The macro *does* work correctly with Excel 2007 if I step through it in the
debugger (thus introducing delays between each statement), or if I introduce
additional statements before the ch.HasTitle statement (in particular *two*
DoEvents calls seems to work).

My company's application that uses Excel for reports has larger macros
containing similar code that must run correctly on many PCs. Does anyone
know of a safe fix or work-around for this problem?

Sub Macro1()
Dim ws As Worksheet
Dim ch As Chart
Dim s As Series

' Add chart.
Set ws = Worksheets(1)
Set ch = ws.ChartObjects.Add(100, 100, 400, 400).Chart
ch.ChartType = xlXYScatterLines
' Add series to chart.
Set s = ch.SeriesCollection.NewSeries
s.Name = "My series"
s.Values = ws.Range(ws.Cells(1, 2), Cells(10, 2))
s.XValues = ws.Range(ws.Cells(1, 1), Cells(10, 1))
' No title.
ch.HasTitle = False
End Sub

Graham

 
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: Can it SUMIF( ) using color as a condition ? Mr. Low[_2_] Excel Discussion (Misc queries) 7 April 2nd 23 07:44 PM
Excel 2007 Condition Formatting - Dates Miskacee Excel Programming 1 August 11th 09 05:26 PM
Chart Property (e.g.: .HasTitle) reset fails with run-time error 1 Joseph Felcon Excel Programming 4 July 16th 08 09:56 PM
Excel is behaving strangely for no apparent reason. canyondude New Users to Excel 4 January 10th 06 12:07 AM
Excel resizes images with no apparent reason Carlos Lozano Excel Programming 2 August 24th 05 10:23 PM


All times are GMT +1. The time now is 07:23 PM.

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

About Us

"It's about Microsoft Excel"