Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-13-2021, 11:19 AM
puff puff is offline Shape.Left acting weirdly Windows 7 64bit Shape.Left acting weirdly Office 2013
Advanced Beginner
Shape.Left acting weirdly
 
Join Date: Apr 2017
Posts: 60
puff is on a distinguished road
Question 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
but it didn't really make the image to the very left side, although the Horizontal position is now 0". I tried around and noticed that Horizontal position doesn't change when I resize or rotate the image. This doesn't really make sense to me. Could someone help on making a resized and rotated image really aligned to the left side of the slide? Thanks!
Reply With Quote
  #2  
Old 11-15-2021, 08:21 AM
JohnWilson JohnWilson is offline Shape.Left acting weirdly Windows 10 Shape.Left acting weirdly Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Your code should align the image left zero. Maybe you should post a mock up of what you expect to see?
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 11-22-2021, 08:45 AM
puff puff is offline Shape.Left acting weirdly Windows 7 64bit Shape.Left acting weirdly Office 2013
Advanced Beginner
Shape.Left acting weirdly
 
Join Date: Apr 2017
Posts: 60
puff is on a distinguished road
Default

I'm simply expecting the image's left edge will align up with the slide's left edge, but this is not the case.
Reply With Quote
  #4  
Old 11-24-2021, 11:46 AM
JohnWilson JohnWilson is offline Shape.Left acting weirdly Windows 10 Shape.Left acting weirdly 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
Reply

Tags
image adjustments, vba

Thread Tools
Display Modes


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
Shape.Left acting weirdly Tables Acting Up CrossReach Word Tables 10 05-30-2016 03:22 AM
Shape.Left acting weirdly Word acting squirrely again. jmdraft Word 10 11-18-2014 07:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft