Convert Auto Lists to Hard type thru a macro

D

Dana

I'd like to automatically convert auto list numbers and auto list
bullets to hard type. I.e., 1,2,3 in auto list numbers become actually
typed 1,2,3 and the auto generated bullets become a hard typed bullet.
I found in this list how to use the VB
"ActiveDocument.ConvertNumbersToText" command and am trying to put
this in a macro. I can get the macro to work by auto recording the
keystrokes but when done, the macro leaves the VB Editor on the
screen. How can I tell the macro to close VB Editor? My simple macro
looks like: Sub ReplaceAutoGeneratedNumsWithTypedNums()
'
' ReplaceAutoGeneratedNumsWithTypedNums Macro
' Macro recorded 1/18/08 by me'
ShowVisualBasicEditor = True
ActiveDocument.ConvertNumbersToText

End Sub

Also, is there a comparable VB command to convert auto list bullets?
Thanks
 
J

John McGhie

Hi Dana:

You were in Record when you opened the Visual Basic Editor, so it has
recorded that too :)

Simply delete this line:
ShowVisualBasicEditor = True

And then close the VBA editor.

Cheers


ShowVisualBasicEditor = True

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
http://jgmcghie.fastmail.com.au/
Sydney, Australia. S33°53'34.20 E151°14'54.50
+61 4 1209 1410, mailto:[email protected]
 
D

Dana

Hi Dana:

You were in Record when you opened the Visual Basic Editor, so it has
recorded that too :)

Simply delete this line:
ShowVisualBasicEditor = True

And then close the VBA editor.

Cheers


Too Simple...Thanks for the reply...Now, is there a way to specify the
Auto List Bullets in this replace? I'd like to grab them also and
convert to a hard typed bullet....
 
J

John McGhie

Hi Dana:

That macro "should" do it. The bullets are just numbers in Word, they
should all become plain text when you run the macro.

The following is a rather more sophisticated macro that does the same thing,
but enables you to select which part of the document you want "de-listed".

Sub ConvertNumbers()
' Converts all numbers to text
Dim doIt As Long
Dim aSel As Range
Dim alist As List
Dim aPara As Paragraph

Set aSel = Selection.Range
doIt = aSel.End - aSel.Start

If doIt > 1 Then
If aSel.ListParagraphs.Count > 0 Then
aSel.ListParagraphs(1).Range.ListFormat.List.ConvertNumbersToText
End If
Else
doIt = MsgBox("No selection. Do whole document?", vbExclamation +
vbOKCancel)
If doIt = 1 Then
ActiveDocument.ConvertNumbersToText
End If
End If
If doIt > 0 Then MsgBox "All numbering converted to typed text."

End Sub

Hope this helps


Too Simple...Thanks for the reply...Now, is there a way to specify the
Auto List Bullets in this replace? I'd like to grab them also and
convert to a hard typed bullet....

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
http://jgmcghie.fastmail.com.au/
Sydney, Australia. S33°53'34.20 E151°14'54.50
+61 4 1209 1410, mailto:[email protected]
 

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