A
ArthurN
Hi,
I have this teaching macro for foreign language learning, which goes through
the story, selects the words/phrases with the "Inlinevocabulary" style,
replaces them with a numbered gap, takes the words to the end of the story,
assigns "wordstoinsert" style (so that later students could pick a word and
insert it into the story.
But, this script works on a whole story/documents only, now I have projects
where I have several stories in a single document and I would like my macro
to work on a range/single story and insert the selected words at the end of
that range and then go to the second story and do the same thing, etc.
Hope somebody could help me here.
Here's the original macro:
Sub Vocabulary()
'
' AutoExit.MAIN Macro
'
'
Dim rDcm As Range
Dim LCnt As Long
Set rDcm = ActiveDocument.Range
rDcm.InsertAfter vbCrLf
With rDcm.Find
.Style = "InlineVocabulary"
While .Execute
rDcm.Select ' for testing
ActiveDocument.Range.InsertAfter rDcm.Text & vbCrLf
ActiveDocument.Paragraphs.Last.Previous.Range.Style = "WordsToInsert"
Wend
End With
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Style = "InlineVocabulary"
While .Execute
LCnt = LCnt + 1
rDcm.Select ' for testing
rDcm.Text = "(" & CStr(LCnt) & "). _________"
rDcm.Collapse Direction:=wdCollapseEnd
Wend
End With
End Sub
Thank you in advance,
Arthur
I have this teaching macro for foreign language learning, which goes through
the story, selects the words/phrases with the "Inlinevocabulary" style,
replaces them with a numbered gap, takes the words to the end of the story,
assigns "wordstoinsert" style (so that later students could pick a word and
insert it into the story.
But, this script works on a whole story/documents only, now I have projects
where I have several stories in a single document and I would like my macro
to work on a range/single story and insert the selected words at the end of
that range and then go to the second story and do the same thing, etc.
Hope somebody could help me here.
Here's the original macro:
Sub Vocabulary()
'
' AutoExit.MAIN Macro
'
'
Dim rDcm As Range
Dim LCnt As Long
Set rDcm = ActiveDocument.Range
rDcm.InsertAfter vbCrLf
With rDcm.Find
.Style = "InlineVocabulary"
While .Execute
rDcm.Select ' for testing
ActiveDocument.Range.InsertAfter rDcm.Text & vbCrLf
ActiveDocument.Paragraphs.Last.Previous.Range.Style = "WordsToInsert"
Wend
End With
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Style = "InlineVocabulary"
While .Execute
LCnt = LCnt + 1
rDcm.Select ' for testing
rDcm.Text = "(" & CStr(LCnt) & "). _________"
rDcm.Collapse Direction:=wdCollapseEnd
Wend
End With
End Sub
Thank you in advance,
Arthur