ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel 2007 VBA problem (https://www.excelbanter.com/excel-discussion-misc-queries/137039-excel-2007-vba-problem.html)

teepee

Excel 2007 VBA problem
 
Hello

Could any knowledgable person please help.

I try to run a VBA code that woks fine in Excel 2003 and it crashes in 2007.

The offending line is

ActiveSheet.ChartObjects("Chart 542").Activate

What could possibly be wrong with that?

Is it me or is Excel 2007 not there yet?



JMay

Excel 2007 VBA problem
 
Try
Replacing: Activesheet
with:
Sheets("MySheet")

my 2 cents...


"teepee" wrote in message
:

Hello

Could any knowledgable person please help.

I try to run a VBA code that woks fine in Excel 2003 and it crashes in 2007.

The offending line is

ActiveSheet.ChartObjects("Chart 542").Activate

What could possibly be wrong with that?

Is it me or is Excel 2007 not there yet?



Jim Rech

Excel 2007 VBA problem
 
I probably spend more time addressing issues related to
drawingobjects/shapes when trying to get my apps to run in XL07 than
anything else. Strangely enough though your code runs fine for me. Even
the recorder records the same code.

--
Jim
"teepee" wrote in message
...
| Hello
|
| Could any knowledgable person please help.
|
| I try to run a VBA code that woks fine in Excel 2003 and it crashes in
2007.
|
| The offending line is
|
| ActiveSheet.ChartObjects("Chart 542").Activate
|
| What could possibly be wrong with that?
|
| Is it me or is Excel 2007 not there yet?
|
|



teepee

Excel 2007 VBA problem
 

"Jim Rech" wrote in message
...
I probably spend more time addressing issues related to
drawingobjects/shapes when trying to get my apps to run in XL07 than
anything else. Strangely enough though your code runs fine for me. Even
the recorder records the same code.

Yes my recorder does the same. Bizarre.



teepee

Excel 2007 VBA problem
 
I recorded the following in 2007

Sub Macro1()
'
' Macro1 Macro
'

'
ActiveSheet.ChartObjects("Chart 542").Activate
ActiveChart.PlotArea.Select
ActiveSheet.ChartObjects("Chart 541").Activate
ActiveChart.PlotArea.Select
ActiveSheet.ChartObjects("Chart 543").Activate
ActiveChart.PlotArea.Select
Selection.Left = 3.75
Selection.Top = 2.75
Range("E22").Select
End SubSub Macro1()

And when I ran it it still crashed on the first line



teepee

Excel 2007 VBA problem
 
Weirder still, if I create a sheet within 2007 it has no problem with the
commands but if it's created within 2003 it can't cope.



teepee

Excel 2007 VBA problem
 
I found the problem. The sheet protection option that allows for editing
objects doesn't work in 2007



Nick Hodge

Excel 2007 VBA problem
 
Jim

It is acknowledged that this is 'broken' in XL2007. The charts and drawing
objects (now SmartArt) are shared across apps (Word/Excel/PowerPoint), so it
will take an SP or v.next I suspect for the object model/recorder to catch
up properly. It always becomes an issue when different teams get involved
across apps

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk
blog: www.nickhodge.co.uk/blog/

FREE UK OFFICE USER GROUP MEETING, MS READING, 27th APRIL 2007
www.officeusergroup.co.uk

"Jim Rech" wrote in message
...
I probably spend more time addressing issues related to
drawingobjects/shapes when trying to get my apps to run in XL07 than
anything else. Strangely enough though your code runs fine for me. Even
the recorder records the same code.

--
Jim
"teepee" wrote in message
...
| Hello
|
| Could any knowledgable person please help.
|
| I try to run a VBA code that woks fine in Excel 2003 and it crashes in
2007.
|
| The offending line is
|
| ActiveSheet.ChartObjects("Chart 542").Activate
|
| What could possibly be wrong with that?
|
| Is it me or is Excel 2007 not there yet?
|
|





All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com