VB and Powerpoint

@

@

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
 
S

Shyam Pillai

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?
 
S

Shyam Pillai

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
 
S

Shyam Pillai

Use:
With ActiveWindow.Selection.ShapeRange
.Align msoAlignCenters, True
.IncrementLeft 50
End With
 
@

@

Under format/picture/size Scale you enter a %

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

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