PC Review


Reply
Thread Tools Rate Thread

BringToFront syntax question

 
 
=?Utf-8?B?UkFQ?=
Guest
Posts: n/a
 
      25th Aug 2005
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 With Quote
 
 
 
 
Tushar Mehta
Guest
Posts: n/a
 
      25th Aug 2005
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 <6AF535FC-3D1E-45E5-9972-(E-Mail Removed)>,
(E-Mail Removed) 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
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      28th Aug 2005
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open or BringToFront Lars Brownies Microsoft Access 8 30th Jan 2010 07:19 AM
re:Panel.BringToFront() talljames Microsoft C# .NET 0 31st Aug 2004 09:02 PM
re:Panel.BringToFront() talljames Microsoft C# .NET 0 31st Aug 2004 09:02 PM
Problem with BringToFront() C# Learner Microsoft Dot NET 1 13th Feb 2004 03:41 AM
.BringtoFront doesn't Eric Goforth Microsoft VB .NET 2 12th Oct 2003 02:10 AM


Features
 

Advertising
 

Newsgroups
 


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