Dave
Fri Apr 15 14:03:01 CDT 2005
Great. Thanks for the tip. I'll definitely give it a shot.
"Jean-Guy Marcil" wrote:
> Dave was telling us:
> Dave nous racontait que :
>
> > I'm populating a table using predefinded autotext chosen by selecting
> > checkboxes on several forms, the table has a blank row with a single
> > bookmark that all checkboxes reference. See example below.
> >
> > If chk1.Value = True Then
> > ActiveDocument.Bookmarks("ActionItems").Select
> > ActiveDocument.AttachedTemplate.AutoTextEntries("Electrical
> > SafetyGFCIs") _ .Insert Where:=Selection.Range
> > End If
> >
> > I'd like the order of entries in the table to reflect the order
> > chosen on the forms. Currently the first option chosen shows up last,
> > and the last option shows up first. I don't believe there's an insert
> > before or after with the method I'm using above. Does anyone have any
> > suggestions on I can influence the order?
> >
> > I hope this makes sense. Any help would be greatIy appreciated.
>
> Here is a little something I cooked up that might be of interest!
> Basically, I avoid the selection object like the pest!
>
> '_______________________________________
> Sub Main()
>
> Dim InsertRange As Range
>
> Set InsertRange = ActiveDocument.Bookmarks("ActionItems").Range
>
> Set InsertRange = InsertMyAutoText(InsertRange, _
> "Electrical SafetyGFCIs")
> Set InsertRange = InsertMyAutoText(InsertRange, _
> "Next one")
> Set InsertRange = InsertMyAutoText(InsertRange, _
> "Another one")
> Set InsertRange = InsertMyAutoText(InsertRange, _
> "Last one")
>
> End Sub
> '_______________________________________
>
> '_______________________________________
> Function InsertMyAutoText(TargetRange As Range, _
> AutoTextName As String) As Range
>
> With TargetRange
> .Text = AutoTextName
> .InsertAutoText
> .Collapse wdCollapseEnd
> End With
>
> Set InsertMyAutoText = TargetRange
>
> End Function
> '_______________________________________
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site:
http://www.word.mvps.org
>
>
>
>