Re: VBA macro for Picture Formatting by Gregory
Gregory
Sat Jul 05 11:42:43 PDT 2008
Jim,
I just stumbled on it myself. After seeing that you didn't want left
alignment (easy enough). I recorded the process and teh constant
wdShapeRight appeared in the maze of recorded coded. F1 on wdShapeRight,
wdShapeLeft and wdShapeCenter produces no help found :-(.
MathTeacher wrote:
> 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...@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