LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
lee lee is offline
external usenet poster
 
Posts: 184
Default Excel 2007 won't execute 2003 VBA code

I have a macro that was created with Excel 2003 VBA code but sometimes Excel
2007 won't execute the code and sometimes it will. Any ideas what might be
happening? Is Excel 2007 supposed to be backwards compatible? I can't use
the new Excel 2007 code because not all my users have Excel 2007 yet. Most
are still using Excel 2003.

Excel 2003 Code:
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = strTitle + Chr(10) + strSubTitle
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = strXAxis
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = strYAxis
End With

However, this code does the same thing in Excel 2007 and it always works:
Excel 2007 code:
With ActiveChart
.SetElement (msoElementChartTitleAboveChart)
.ChartTitle.Text = strTitle + Chr(10) + strSubTitle
.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
.Axes(xlCategory, xlPrimary).AxisTitle.Text = strXAxis
.SetElement (msoElementPrimaryValueAxisTitleRotated)
.Axes(xlValue, xlPrimary).AxisTitle.Text = strYAxis
End With

Thanks in advance,
Lee

 
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 erases VBA code from Excel 2003 Andrew[_56_] Excel Programming 4 April 16th 09 12:25 PM
Should this code work in Excel 2007 as it does in 2003? Tim Miller Excel Programming 1 February 13th 09 09:52 PM
2003--2007 recognize if i'm in 2007 or 2003 via code. Miri Excel Programming 3 October 15th 08 02:50 PM
Automation C++ code works for Excel 2003, not for Excel 2007 jayo Excel Programming 0 August 6th 08 06:51 PM
Help Excel 2003 code failing in 2007 Bob C Excel Programming 12 July 25th 08 03:27 PM


All times are GMT +1. The time now is 12:44 PM.

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"