Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problems with my links to an excel 2007 file from a word 2007 file | Links and Linking in Excel | |||
Excel 2007 | Excel Discussion (Misc queries) | |||
excel 2007 | Excel Discussion (Misc queries) | |||
Excel 2007 | Excel Worksheet Functions | |||
Office 2007 Pro Plus 2007 (Beta) - getting small red and green arr | Excel Discussion (Misc queries) |