View Single Post
 
Old 11-24-2021, 11:46 AM
JohnWilson JohnWilson is offline Windows 10 Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

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
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials

Last edited by JohnWilson; 11-25-2021 at 06:27 AM.
Reply With Quote