Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
RAP
 
Posts: n/a
Default BringToFront syntax question

Hello,
I have 3 chartobjects "layered" on top of each other in a worksheet. Based
on a cell value, I want to "BringToFront" the correct chart. I have named
the charts by getting the first chart on top, holding the CTRL key while
clicking in the chart area, then change the name in the Cell indicator to the
left of the formula bar. I have named the charts Chart1, Chart2 & Chart 3,
this way in the order in which I want them to appear basis the cell number
(1,2,3).
In my code on the Worksheet("Graphs") code page, I cannot get the syntax
correct to "bringtofront" the correct sheet. I've tried everything I can get
my hands on....
activate, chart, chartobject, bringtofront, (1), (Chart1), ("Chart1"), etc...

I keep getting the "Application or Object defined error.
Please advise. I'm all ears.
Thanks,
Randy
  #2   Report Post  
Tushar Mehta
 
Posts: n/a
Default

Turn on the macro recorder (Tools | Macro Record new macro...) then
use the GUI to bring any one object to the front (SHIFT+click or
CTRL+click an object then right-click and from the context menu select
Order Bring to front.

Turn off the macro recorder and switch to the VBE to see what code XL
generated. You will find you have to access the ZOrder property of the
ShapeRange object associated with the chartobject.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hello,
I have 3 chartobjects "layered" on top of each other in a worksheet. Based
on a cell value, I want to "BringToFront" the correct chart. I have named
the charts by getting the first chart on top, holding the CTRL key while
clicking in the chart area, then change the name in the Cell indicator to the
left of the formula bar. I have named the charts Chart1, Chart2 & Chart 3,
this way in the order in which I want them to appear basis the cell number
(1,2,3).
In my code on the Worksheet("Graphs") code page, I cannot get the syntax
correct to "bringtofront" the correct sheet. I've tried everything I can get
my hands on....
activate, chart, chartobject, bringtofront, (1), (Chart1), ("Chart1"), etc...

I keep getting the "Application or Object defined error.
Please advise. I'm all ears.
Thanks,
Randy

  #3   Report Post  
Jon Peltier
 
Posts: n/a
Default

Hint: Turn on the macro recorder, then manually perform the task you wish to
automate. That's how I learned this:

ActiveSheet.Shapes("Chart 1").ZOrder msoBringToFront

Other arguments for ZOrder are msoSendToBack, msoBringForward, and msoSendBackward.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

RAP wrote:

Hello,
I have 3 chartobjects "layered" on top of each other in a worksheet. Based
on a cell value, I want to "BringToFront" the correct chart. I have named
the charts by getting the first chart on top, holding the CTRL key while
clicking in the chart area, then change the name in the Cell indicator to the
left of the formula bar. I have named the charts Chart1, Chart2 & Chart 3,
this way in the order in which I want them to appear basis the cell number
(1,2,3).
In my code on the Worksheet("Graphs") code page, I cannot get the syntax
correct to "bringtofront" the correct sheet. I've tried everything I can get
my hands on....
activate, chart, chartobject, bringtofront, (1), (Chart1), ("Chart1"), etc...

I keep getting the "Application or Object defined error.
Please advise. I'm all ears.
Thanks,
Randy


Reply
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
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Data Validation Syntax Question Jim & Gail Excel Discussion (Misc queries) 2 April 7th 05 04:17 AM
syntax question - cell references in VB code needyourhelp New Users to Excel 1 March 2nd 05 08:52 PM
An easy macro question and one I believe to be a little more diffi TroutKing Excel Worksheet Functions 3 January 18th 05 09:17 PM
Previous Post - Correct Syntax Query Clarence Crow Excel Worksheet Functions 0 December 7th 04 05:35 AM


All times are GMT +1. The time now is 12:53 AM.

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"