Re: Macro doesn't perform by Greg
Greg
Sat Jul 31 17:42:08 CDT 2004
Steve,
That works great. Thanks. I am still preplexed why I can insert frame
defined as an AutoText entry, but if I record a macro of performing those
steps then run it, nothing happens.
--
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in gmaxey@whamspammvps.org
Word Heretic wrote:
> G'day "Greg" <anonymous@discussions.microsoft.com>,
>
> Oft macros are bad starters for your VBA. Here's some code to play
> with for you.
>
>
> Public Sub FrameMaker()
> 'NOT the (c) Adobe thing!
> Dim MyFrame As Frame
> Dim MyRange As Range
>
> Set MyRange = Selection.Range
> Set MyFrame = ActiveDocument.Frames.Add(MyRange)
>
> With MyFrame
>
>
> 'Colour it
>
> .Shading.BackgroundPatternColor = wdColorBlue
>
>
> 'Size it
>
> .WidthRule = wdFrameExact
> .Width = 100
>
> .HeightRule = wdFrameExact
> .Height = 100
>
>
> 'Position it
>
> .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
> .RelativeVerticalPosition = wdRelativeVerticalPositionPage
> .HorizontalPosition = 100
> .VerticalPosition = 100
>
>
> 'Some text
>
> .Range.InsertAfter "Get a big blue box in ya!"
> End With
>
> Set MyFrame = Nothing
> End Sub
>
> Steve Hudson - Word Heretic
> Want a hyperlinked index? S/W R&D? See WordHeretic.com
>
> steve from wordheretic.com (Email replies require payment)
>
>
> Greg reckoned:
>
>> I am trying to insert preformatted frames in a document.
>> First just recorded a macro of inserting a frame, but then
>> I was unable to record the steps for selectiong and
>> altering the size and fill color.
>>
>> Next I formatted a frame the way I like and created an
>> AutoText entry "AddFrame". I can use Insert>Autotext to
>> insert the frame and I can recorde a macro of preforming
>> that step. The recorded macro looks like this:
>>
>> Sub Macro1()
>>
>> Application.DisplayAutoCompleteTips = True
>> NormalTemplate.AutoTextEntries("AddFrame").Insert _
>> Where:=Selection.Range
>>
>> End Sub
>>
>> For some reason when I fire this macro nothing happens.
>> Can anyone explain?