Defining shape dimensions

masood143

New Member
Joined
Jan 16, 2019
Messages
2
Hi Dears,
I am trying to draw a 3d box (shape type 14) with VBA, but I cannot find the required parameter to define its depth. The width and height parameters are very clear, but I am unable to change the default depth of this shape.

The command used to draw the box is;

DIM MyShaep as Shapes

Set MyShape = ActiveSheet.Shapes.AddShape(
Type:= 14, _
Left:= 20, Top:= 50, _
Width:=60, Height:=60)

It might be very simple, but any help is highly appreciated.

Regards,
Masood.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You cannot do that - depth does not exist
It is NOT a cube - it is a 2D shape "pretending" to be a cube


If you record a macro as the shape is resized this is the result
Code:
    ActiveSheet.Shapes.Range(Array("Cube 2")).Select
    Selection.ShapeRange.ScaleWidth 0.6625423018, msoFalse, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleHeight 0.776859938, msoFalse, msoScaleFromBottomRightt

Someone good at maths may be able to find a way to manipulate "fake" cubes in a predictable way
 
Upvote 0
Thanks.

I have managed to control the so called 'Depth' by the following code line;

Selection.ShapeRange.Adjustments.Item(1) = 0.1

I guess that 0.1 means 10% of the shape Height.

Regards,
Masood.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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