Macro doesn't perform

G

Greg

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?
 
W

Word Heretic

G'day "Greg" <[email protected]>,

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:
 
G

Greg Maxey

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.
 
W

Word Heretic

G'day "Greg Maxey" <[email protected]>,

Two different kettles of fish :) Autotext is simple - it plain DONT
CARE what where and when is being inserted - it is SIMPLE stuff.
Insert Autotext at this range. DONE!.

Frame addition and mucking with is a bit vaguer from the recorder POV.


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Greg Maxey reckoned:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top