Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

"Find" an autonumber with a macro?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed - 26 Feb 2007 19:29 GMT
I'm trying to help my son over the phone.  He's got Word 2000 on Windows
2000.  He's just discovered recording macros.  He's working on formatting a
multiple choice test for the school he works at, and he wants to record a
macro that will find every autonumbered answer "d.", go to the end of the
line, and put an extra line break in.  I can help him with everything else,
but I can't seem to get "Find" to see the autonumbers.  Any help is welcome.

Ed
Shauna Kelly - 26 Feb 2007 20:50 GMT
Hi Ed

Let's go back and work out what he wants to achieve. My guess is that he has
something like:

Q. What is the capital of Australia?
(a) Sydney
(b) Melbourne
(c) Canberra
(d) Adelaide

Q. Next question....

And what he really wants is space between the (d) response and the question.
Or, to put it terms useful for Word, he wants space before each Question.

Is that the issue?

If so, then the best way is to create a new style called, say, Question.
Modify the style to have an appropriate amount of Space Before, and apply it
to each question. It would be a good idea to format this style with "Keep
with next". If you do that, Word will always keep this paragraph on the same
page as the next paragraph. So (unless you leave an empty paragraph between
the Question and the first response), the Question will never dangle alone
at the bottom of a page.

For more information on applying and modifying styles see

How to apply a style in Microsoft Word
http://www.ShaunaKelly.com/word/styles/ApplyAStyle.html

How to modify styles in Microsoft Word
http://www.ShaunaKelly.com/word/styles/ModifyAStyle.html

If there are many questions, and each question starts in a systematic way,
then you can use Edit > Replace to apply the style. Click the More button to
see the list of styles.

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

> I'm trying to help my son over the phone.  He's got Word 2000 on Windows
> 2000.  He's just discovered recording macros.  He's working on formatting
[quoted text clipped - 5 lines]
>
> Ed
Ed - 26 Feb 2007 23:23 GMT
Hi, Shauna.  You've got it exactly.  Unfortunately, while the Styles
solution would indeed be the best,
> If there are many questions, and each question starts in a systematic way,
> then you can use Edit > Replace to apply the style.
I don't think "systematic" applies.  Someone else typed it and give it to
him with instructions to "make it look like this".  And the only
"systematic" thing is - they all start with a "top level" autonumber!  so
then he's stuck going through each question on every teacher's test paper
applying the style to each question - and dealing with any problems that may
cause to the autonumbering.

Is there any hope?

Ed

> Hi Ed
>
[quoted text clipped - 49 lines]
>>
>> Ed
Klaus Linke - 27 Feb 2007 00:36 GMT
Hi Ed,

Something like this should do the trick:
(make a backup first!)

Dim myPara As Paragraph
Dim myRange As Range
Set myRange = Selection.Range.Duplicate
For Each myPara In myRange.Paragraphs
  If myPara.Range.ListFormat.ListString Like "[a-d]." Then
     myPara.Style = ActiveDocument.Styles(wdStyleListNumber)
  End If
Next myPara

It applies the "List Number" style, which you could then modify if
necessary.

To apply some other style, use the style name in quotes instead of
wdStyleListNumber:
     myPara.Style = ActiveDocument.Styles("MyListStyle")

Regards,
Klaus

> Hi, Shauna.  You've got it exactly.  Unfortunately, while the Styles
> solution would indeed be the best,
[quoted text clipped - 64 lines]
>>>
>>> Ed
Ed - 27 Feb 2007 13:38 GMT
Thank you, Klaus!  It works great!
Ed

> Hi Ed,
>
[quoted text clipped - 88 lines]
>>>>
>>>> Ed
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.