Helping needed with my teaching

A

ArthurN

Hi,
Hope somebody can help me here. I need a macro for my teaching purposes to
create a cloze (or fill in the gaps) assignment. Here’s an example:

I have a story in which some words or phrases are assigned a specific inline
style. For example, in the previous sentence the word “which†and the phrase
“phrases are assigned†could have been chosen for this.

Now, I need to follow the following steps to create a cloze task:
1. Select all the word in the story by their set style, say “inlineboldâ€
2. Move/copy them to the end of the story or before the next heading2 element
3. Assign them another set style (e.g. “wordstoinsertâ€)
4. Sort them alphabetically
5. Number them the following way “1. ____ word/phraseâ€
6. Split them into two columns
7. Delete the words from the story “inlinebold†substituting them by inline
numbering “ … (1) … “

There’re of course different software packages on the market that would do
the job, but not the way I want it:
1. They can’t select phrases (big trouble if you want to practice idioms
with the ESL students)
2. They don’t work with a pre-formatted story thus lacking the flexibility
of Ms Word
I know macros a bit, but to a newbie that I am this seems an unmanageable
project.
Thanks in advance to all who would try to help,
ArthurN
 
H

Helmut Weber

Hi Arthur,

these are too many questions at once.
Split it up in smaller pieces.

Maybe you better post in microsoft.public.word.vba
There is much more traffic there.

Tell us about your Word-version!

I admit, I don't know, what an "inline style" is.
The usual term might "character style".
1. Select all the word in the story by their set style, say “inlinebold”
There is no need to select anything.
There is something like a discontiguous selection,
but it was never finished programmatically.
2. Move/copy them to the end of the story or before the next heading2 element
3. Assign them another set style (e.g. “wordstoinsert”)
4. Sort them alphabetically
5. Number them the following way “1. ____ word/phrase”
6. Split them into two columns
7. Delete the words from the story “inlinebold” substituting them by inline
numbering “ … (1) … “

Have a look at this one,
which isn't all you want,
but probably enough to make a newbie
wonder for a while.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
H

Helmut Weber

Forgot to paste the code, grhhh....

Sub Test6777()
Dim rDcm As Range
Dim LCnt As Long
Set rDcm = ActiveDocument.Range
rDcm.InsertAfter vbCrLf
With rDcm.Find
.Style = "InlineBold"
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 = "WordsToInsert"
If .Execute Then
rDcm.Select
Selection.End = ActiveDocument.Range.End - 1
Selection.Sort
End If
End With

Set rDcm = ActiveDocument.Range
With rDcm.Find
.Style = "InlineBold"
While .Execute
LCnt = LCnt + 1
rDcm.Select ' for testing
rDcm.Text = "... (" & CStr(LCnt) & ") ..."
rDcm.Collapse Direction:=wdCollapseEnd
Wend
End With

End Sub


--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

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