tabular order

D

Dave

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.

Thanks,

Dave
(e-mail address removed)
 
J

Jean-Guy Marcil

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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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