From: MathTeacher on
Since I cannot record this operation as macro, I need some help with the VBA
to create the macro.

I want to select a picture (object) in MSWord and format it for Square
wrapping and aligned to the Right Margin. I have been through the objects and
methods and cannot find what I need. I used this to at least get the wrapping
I want.

Sub Macro3()
Dim MyShape As Shape
Set MyShape = Selection.InlineShapes(1).ConvertToShape
MyShape.WrapFormat.Type = wdWrapSquare
MyShape.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
myShapeRange.Align msoAlignRight, True
End Sub

Thx, Jim

From: Greg Maxey on
Try:

Sub Macro3()
Dim MyShape As Shape
Set MyShape = Selection.InlineShapes(1).ConvertToShape
MyShape.WrapFormat.Type = wdWrapSquare
MyShape.RelativeHorizontalPosition =
wdRelativeHorizontalPositionMargin
MyShape.Left = InchesToPoints(0)
End Sub


On Jul 2, 7:05 pm, MathTeacher <MathTeac...(a)discussions.microsoft.com>
wrote:
> Since I cannot record this operation as macro, I need some help with the VBA
> to create the macro.
>
> I want to select a picture (object) in MSWord and format it for Square
> wrapping and aligned to the Right Margin. I have been through the objects and
> methods and cannot find what I need. I used this to at least get the wrapping
> I want.
>
> Sub Macro3()
>     Dim MyShape As Shape
>     Set MyShape = Selection.InlineShapes(1).ConvertToShape
>     MyShape.WrapFormat.Type = wdWrapSquare
>     MyShape.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
>     myShapeRange.Align msoAlignRight, True
> End Sub
>
> Thx, Jim

From: MathTeacher on
Thanks Greg for the attempt, but that did not work. It set the distance from
the left margin to 0; basically left-justified. What I need is the
method/property that is equivalent to Alignment | Right | relative to Margin
in Word parlance. Found under Picture Formating | Layout | Advanced |
Hotizontal |Alignment.
Jim

"Greg Maxey" wrote:

> Try:
>
> Sub Macro3()
> Dim MyShape As Shape
> Set MyShape = Selection.InlineShapes(1).ConvertToShape
> MyShape.WrapFormat.Type = wdWrapSquare
> MyShape.RelativeHorizontalPosition =
> wdRelativeHorizontalPositionMargin
> MyShape.Left = InchesToPoints(0)
> End Sub
>
>
> On Jul 2, 7:05 pm, MathTeacher <MathTeac...(a)discussions.microsoft.com>
> wrote:
> > Since I cannot record this operation as macro, I need some help with the VBA
> > to create the macro.
> >
> > I want to select a picture (object) in MSWord and format it for Square
> > wrapping and aligned to the Right Margin. I have been through the objects and
> > methods and cannot find what I need. I used this to at least get the wrapping
> > I want.
> >
> > Sub Macro3()
> > Dim MyShape As Shape
> > Set MyShape = Selection.InlineShapes(1).ConvertToShape
> > MyShape.WrapFormat.Type = wdWrapSquare
> > MyShape.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
> > myShapeRange.Align msoAlignRight, True
> > End Sub
> >
> > Thx, Jim
>
>
From: Gregory K. Maxey on
Duh!! I should have read the question a little better ;-)

Change:

MyShape.Left = InchesToPoints(0)

To:

MyShape.Left = wdShapeRight


MathTeacher wrote:
> Thanks Greg for the attempt, but that did not work. It set the
> distance from the left margin to 0; basically left-justified. What I
> need is the method/property that is equivalent to Alignment | Right |
> relative to Margin in Word parlance. Found under Picture Formating |
> Layout | Advanced | Hotizontal |Alignment.
> Jim
>
> "Greg Maxey" wrote:
>
>> Try:
>>
>> Sub Macro3()
>> Dim MyShape As Shape
>> Set MyShape = Selection.InlineShapes(1).ConvertToShape
>> MyShape.WrapFormat.Type = wdWrapSquare
>> MyShape.RelativeHorizontalPosition =
>> wdRelativeHorizontalPositionMargin
>> MyShape.Left = InchesToPoints(0)
>> End Sub
>>
>>
>> On Jul 2, 7:05 pm, MathTeacher
>> <MathTeac...(a)discussions.microsoft.com> wrote:
>>> Since I cannot record this operation as macro, I need some help
>>> with the VBA to create the macro.
>>>
>>> I want to select a picture (object) in MSWord and format it for
>>> Square wrapping and aligned to the Right Margin. I have been
>>> through the objects and methods and cannot find what I need. I used
>>> this to at least get the wrapping I want.
>>>
>>> Sub Macro3()
>>> Dim MyShape As Shape
>>> Set MyShape = Selection.InlineShapes(1).ConvertToShape
>>> MyShape.WrapFormat.Type = wdWrapSquare
>>> MyShape.RelativeHorizontalPosition =
>>> wdRelativeHorizontalPositionMargin myShapeRange.Align
>>> msoAlignRight, True
>>> End Sub
>>>
>>> Thx, Jim


From: MathTeacher on
It works fine, thanks for the time and effort. I wish I could find a complete
list and description of all the Word VBA objects, properties and methods. The
MSDN on-line stuff is virtually impossible to navigate and is disjoint.

Jim

"Gregory K. Maxey" wrote:

> Duh!! I should have read the question a little better ;-)
>
> Change:
>
> MyShape.Left = InchesToPoints(0)
>
> To:
>
> MyShape.Left = wdShapeRight
>
>
> MathTeacher wrote:
> > Thanks Greg for the attempt, but that did not work. It set the
> > distance from the left margin to 0; basically left-justified. What I
> > need is the method/property that is equivalent to Alignment | Right |
> > relative to Margin in Word parlance. Found under Picture Formating |
> > Layout | Advanced | Hotizontal |Alignment.
> > Jim
> >
> > "Greg Maxey" wrote:
> >
> >> Try:
> >>
> >> Sub Macro3()
> >> Dim MyShape As Shape
> >> Set MyShape = Selection.InlineShapes(1).ConvertToShape
> >> MyShape.WrapFormat.Type = wdWrapSquare
> >> MyShape.RelativeHorizontalPosition =
> >> wdRelativeHorizontalPositionMargin
> >> MyShape.Left = InchesToPoints(0)
> >> End Sub
> >>
> >>
> >> On Jul 2, 7:05 pm, MathTeacher
> >> <MathTeac...(a)discussions.microsoft.com> wrote:
> >>> Since I cannot record this operation as macro, I need some help
> >>> with the VBA to create the macro.
> >>>
> >>> I want to select a picture (object) in MSWord and format it for
> >>> Square wrapping and aligned to the Right Margin. I have been
> >>> through the objects and methods and cannot find what I need. I used
> >>> this to at least get the wrapping I want.
> >>>
> >>> Sub Macro3()
> >>> Dim MyShape As Shape
> >>> Set MyShape = Selection.InlineShapes(1).ConvertToShape
> >>> MyShape.WrapFormat.Type = wdWrapSquare
> >>> MyShape.RelativeHorizontalPosition =
> >>> wdRelativeHorizontalPositionMargin myShapeRange.Align
> >>> msoAlignRight, True
> >>> End Sub
> >>>
> >>> Thx, Jim
>
>
>