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 Excel 2007 Bug

I have run this code (stripped down code shown below) for over 4 years now
in both Excel 97 and 2003. I am now trying out 2007 but the VBA code to
create my charts is failing. I have found 2 workarounds but it seems like
madness for me to use them. Am I doing something wrong? I think I may be
going mad...



Option Explicit
' Excel 2007 VBA Bug example
'
' Execute BuggedExcel()

Public Sub BuggedExcel()
Dim chtChart As Chart

Dim FixLevel As Integer

FixLevel = 0 'Toggles whether to work-around the Excel 2007 VBA bug.

Set chtChart = ActiveSheet.ChartObjects.Add(0, 0, 184, 95).Chart

Select Case FixLevel
Case 0
'No fix

Case 1
Dim x As Integer
x = chtChart.PlotArea.Top

Case 2
'This fix will only work if you press F5 and not the play button on
the toolbar!
DoEvents

End Select

'The following method (x.Top = 0) fails in Excel 2007 unless the 2 lines
above are executed. Works fine in all previous Excel versions.
'When this fails in 2007, if the User clicks Debug they can step
through/re-run the exact same lines and the code runs without issues.
chtChart.PlotArea.Top = 0

Set chtChart = Nothing

End Sub




 
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 files not showing on screen when opened in Excel 2007 [email protected] Setting up and Configuration of Excel 1 January 8th 09 05:45 PM
Conflict in excel 2007 with Outlook 2007 attachment excel narnimar Excel Discussion (Misc queries) 0 December 17th 08 02:02 PM
Labels: Unable to import all records Excel 2007 to Word 2007 Mailm skelly Excel Discussion (Misc queries) 1 October 29th 08 11:22 PM
Excel 2007 Macro Help (Excel 2003 not working in 2007) Pman Excel Discussion (Misc queries) 4 May 29th 08 06:29 PM
Paste EXCEL 2007 sheet into WORD 2007 - objects move around Martin L Excel Discussion (Misc queries) 5 February 29th 08 01:45 PM


All times are GMT +1. The time now is 10:22 AM.

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"