VB and Powerpoint

  • Thread starter Thread starter @
  • Start date Start date
@

@

in vb I wrote the following on an object that I have scaled to 150%

Msgbox ActiveWindow.Selection.ShapeRange.Width

It gives me its UNSCALED width

while

Msgbox ActiveWindow.Selection.ShapeRange.ScaleWidth give me an error

How do i get the true scaled width?

TIA
 
ActiveWindow.Selection.ShapeRange.Width always gives you the actual width of
the shape in point.
what the shape in question?
 
Sample of powerpoint or sample vb code


Is is very simple Instead of assuming that I wan to center an object
assume I want to offset it 50 pixels and the picture size is 150%

this macro will not work if I try running it while highlighting the
picture

ActiveWindow.Selection.ShapeRange.Left = (ActiveWindow.Width -
ActiveWindow.Selection.ShapeRange.Width) + 50


It will only work if the oicture is scaled to 100%. Is there a work
around?
 
Use the IncrementLeft method instead. ActiveWindow.Width returns the width
of the activewindow, it has got nothing to do with the slide in question.

' Increment current position by 50 points.
Call Activewindow.Selection.ShapeRange.IncrementLeft(50)
 
Yes but aI first need to determine the center position which I cannot
do if I cannot get the true scaled size of the object
 
Here is another example for centering that work if but again it only
works with a scale of 1. So is there a way to retrieve the width of
an object


ActiveWindow.Selection.ShapeRange.ScaleHeight 1, msoTrue
ActiveWindow.Selection.ShapeRange.ScaleWidth 1, msoTrue
With ActivePresentation.PageSetup
ActiveWindow.Selection.ShapeRange.Left = (.SlideWidth \ 2) -
(ActiveWindow.Selection.ShapeRange.Width \ 2)
ActiveWindow.Selection.ShapeRange.Top = (.SlideHeight \ 2) -
(ActiveWindow.Selection.ShapeRange.Height \ 2)
ActiveWindow.Selection.ShapeRange.Select
End With



So is there a way to retrieve the SCALEwidth of an object
 
Use:
With ActiveWindow.Selection.ShapeRange
.Align msoAlignCenters, True
.IncrementLeft 50
End With
 
in vb I wrote the following on an object that I have scaled to 150%
Msgbox ActiveWindow.Selection.ShapeRange.Width
It gives me its UNSCALED width

I'm not sure what you mean by "scaled"
Can you describe how you scaled the shape?

The .Width property reports the current width of the shape in points.
It doesn't take into account how large the shape was originally or what's been
done to it since.
while
Msgbox ActiveWindow.Selection.ShapeRange.ScaleWidth give me an error

You can display the value of properties like .Width, but ScaleWidth is a
method, a verb so to speak. It tells PPT to enlarge or reduce the shape by a
certain amount.

You can reset some shapes (pictures, for example) to their original imported
size with

..ScaleWidth 1, msoFalse
..ScaleHeight 1, msoFalse



--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
Under format/picture/size Scale you enter a %

If I want to know the value or change the value how would I do it?
 
Under format/picture/size Scale you enter a %

If I want to know the value or change the value how would I do it?

Set the scalemode to 1 for both width and height then compare the resulting size
with the size of the object before you set it back to the original scale. Work
out the percentage from there. But I still don't see why it's relevant.


--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
You're trying to center the shape, right?
At its current size?

Leave off the first two lines,

Here is another example for centering that work if but again it only
works with a scale of 1. So is there a way to retrieve the width of
an object

LOSE THESE ...
ActiveWindow.Selection.ShapeRange.ScaleHeight 1, msoTrue
ActiveWindow.Selection.ShapeRange.ScaleWidth 1, msoTrue

USE THIS ...
With ActivePresentation.PageSetup
ActiveWindow.Selection.ShapeRange.Left = (.SlideWidth \ 2) -
(ActiveWindow.Selection.ShapeRange.Width \ 2)
ActiveWindow.Selection.ShapeRange.Top = (.SlideHeight \ 2) -
(ActiveWindow.Selection.ShapeRange.Height \ 2)
End With

AND YOU DON'T NEED TO WORRY ABOUT THIS:
So is there a way to retrieve the SCALEwidth of an object

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
Back
Top