Double AutoShape Dimensions

P

Pinky

I want to create a macro that doubles my AutoShape dimensions and
recorded/edited this code:

Sub twosize()
With ActiveWindow.Selection.ShapeRange
..LockAspectRatio = msoTrue
..Height = (ActiveWindow.Selection.ShapeRange.Height) * 2
..Width = (ActiveWindow.Selection.ShapeRange.Width) * 2
End With
End Sub

However this increases my shape dimensions by 4 times - a 1 cm square
becomes 4.01 cm square.

What can I do?

- Pinky
 
S

Sonia

Hey, I know nothing about VBA or macros, but you're doing what you *say* you
want to do. True, if you want to double the width you would multiply by 2. And
if you want to double the height you would multiply by two. That doubles the
dimensions, but at the same time it increases the area of the object by a factor
of 4. Do you want to double the dimensions or double the area? To do the
latter you would multiply the dimensions by 1.5.
--

Sonia Coleman
Microsoft PowerPoint MVP Team
Autorun Software, Templates and Tutorials
http://www.soniacoleman.com
 
S

Sonia

Apparently I don't remember much about math either!! LOL! If you want to
double the area, but keep the same aspect ratio, it's a bit trickier and my
brain isn't muddling up the formula right now.
 
T

Tushar Mehta

To maintain the aspect ratio, square root of 2 or Sqr(2) in VBA.

Original area = height * width

New area = 2 * Original area
= sqr(2) * height * sqr(2) * width

--
Regards,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top