#1
|
|||
|
|||
Shape.Left acting weirdly
I'm trying to align an image to the very left side of a slide. I tried HTML Code:
ActiveWindow.Selection.ShapeRange(1).Left = 0 |
#2
|
|||
|
|||
Your code should align the image left zero. Maybe you should post a mock up of what you expect to see?
|
#3
|
|||
|
|||
I'm simply expecting the image's left edge will align up with the slide's left edge, but this is not the case.
|
#4
|
|||
|
|||
I'm seeing what you mean now. The shape is located at L=0 based on NO rotation. In one sense I can see that makes sense but I didn't think it happened when I first tested it.
Just as a fun task something like this should do what you need Code:
Sub BBox() Dim oshp As Shape Dim lngRot As Long Dim BB_W As Single Dim BB_L As Single Dim offset As Long Dim oshpC(1 To 2) As Single Const deg2Rad As Single = 3.14159 / 180 Set oshp = ActiveWindow.Selection.ShapeRange(1) oshpC(1) = oshp.Left + oshp.Width / 2 oshpC(2) = oshp.Top + oshp.Height / 2 lngRot = oshp.Rotation BB_W = oshp.Height * Abs(Sin(lngRot * deg2Rad)) + oshp.Width * Abs(Cos(lngRot * deg2Rad)) BB_L = oshpC(1) - BB_W / 2 offset = oshp.Left - BB_L oshp.Left = offset End Sub Last edited by JohnWilson; 11-25-2021 at 06:27 AM. |
Tags |
image adjustments, vba |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fit text to shape / Place table in shape | Floppy | PowerPoint | 0 | 04-01-2021 11:01 AM |
right to left and left to right icon missing in paragraph section | mh2019 | Word | 1 | 06-04-2019 11:53 AM |
How to change size / shape of a shape in a stencil | tomgoodell | Visio | 1 | 06-30-2016 04:40 AM |
Tables Acting Up | CrossReach | Word Tables | 10 | 05-30-2016 03:22 AM |
Word acting squirrely again. | jmdraft | Word | 10 | 11-18-2014 07:21 AM |