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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Are you sure the width is set to 21 afterwards? How are you testing this?
 
Upvote 0
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!
 
Upvote 0
That sounds very weird. I wonder if the units involved change depending on what mode the code runs in? No, that would be silly.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,700
Members
448,979
Latest member
DET4492

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
Back
Top