how to change the wordwrap of the selected shape in powerpoint by comobj Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AAHKUser
Posts: 21
Joined: 19 Jun 2020, 04:31

how to change the wordwrap of the selected shape in powerpoint by comobj

Post by AAHKUser » 17 Jan 2022, 03:03

hi everyone, i am new about ComObjectActive, and i have some problem when i try to change the wordwrap and margin of the selected shape in powerpoint. it is a high frequency but no shortcut, cant use alt+jd...

there is my current code, i cant find the selected shape:

Code: Select all

+F3::
oPPT := ComObjectActive("PowerPoint.Application")
SlideNumber := oPPT.ActiveWindow.Selection.SlideRange.SlideIndex 
ShapesNum := oPPT.ActiveWindow.Selection.ShapeRange.SlideIndex  ; this line goes wrong, others are right
oPPT.ActivePresentation.Slides(SlideNumber).Shapes(ShapesNum).TextFrame.MarginBottom := 0
oPPT.ActivePresentation.Slides(SlideNumber).Shapes(ShapesNum).TextFrame.MarginLeft := 0
oPPT.ActivePresentation.Slides(SlideNumber).Shapes(ShapesNum).TextFrame.MarginRight := 0
oPPT.ActivePresentation.Slides(SlideNumber).Shapes(ShapesNum).TextFrame.MarginTop := 0
oPPT.ActivePresentation.Slides(SlideNumber).Shapes(ShapesNum).TextFrame.WordWrap := False
thanks!

User avatar
boiler
Posts: 16903
Joined: 21 Dec 2014, 02:44

Re: how to change the wordwrap of the selected shape in powerpoint by comobj  Topic is solved

Post by boiler » 17 Jan 2022, 06:33

This works for me:

Code: Select all

+F3::
oPPT := ComObjectActive("PowerPoint.Application")
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.MarginBottom := 0
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.MarginLeft := 0
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.MarginRight := 0
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.MarginTop := 0
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.WordWrap := False
return
It's really only meant to be applied to a single selection, which sounds like what you are looking for. If you have more than one shape selected, it only applies it to the first one.

AAHKUser
Posts: 21
Joined: 19 Jun 2020, 04:31

Re: how to change the wordwrap of the selected shape in powerpoint by comobj

Post by AAHKUser » 17 Jan 2022, 07:56

boiler wrote:
17 Jan 2022, 06:33
This works for me:

Code: Select all

+F3::
oPPT := ComObjectActive("PowerPoint.Application")
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.MarginBottom := 0
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.MarginLeft := 0
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.MarginRight := 0
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.MarginTop := 0
oPPT.ActiveWindow.Selection.ShapeRange(1).TextFrame.WordWrap := False
return
It's really only meant to be applied to a single selection, which sounds like what you are looking for. If you have more than one shape selected, it only applies it to the first one.
it works! thank you!

Post Reply

Return to “Ask for Help (v1)”