chart height width VBA problem

mdavide

Board Regular
Joined
Oct 19, 2004
Messages
211
Hi all,

I've a strange problem when I try to change width/height of a graph via VBA: chart changes but with wrong values, that is I write width=77 but it sets width=21! why?
if I run step by step in debug mode, the code works fine!?!

this is my part of code

Code:
ch.Parent.Parent.Shapes(ch.Parent.Name).Top = 0
ch.Parent.Parent.Shapes(ch.Parent.Name).Left = 0
ch.Parent.Parent.Shapes(ch.Parent.Name).Width = 100
ch.Parent.Parent.Shapes(ch.Parent.Name).Height = 150

ch.PlotArea.Top = 0
ch.PlotArea.Left = 3
ch.PlotArea.Width = 77
ch.PlotArea.Height = 130

where ch is a Chart

thanks

DM
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,686
Are you sure the width is set to 21 afterwards? How are you testing this?
 

mdavide

Board Regular
Joined
Oct 19, 2004
Messages
211
I'm sure, I see the chart and I see in th local variables window.
I have a breakpoint at the end of the function, so I move a few steps back then run again and it works fine!
 

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,686
That sounds very weird. I wonder if the units involved change depending on what mode the code runs in? No, that would be silly.
 

mdavide

Board Regular
Joined
Oct 19, 2004
Messages
211
I know it's so strange that I can't find a solution, what I want to know is if there are known bugs of this type.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,805
Messages
5,833,764
Members
430,230
Latest member
Yimmie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top