Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Copy&Paste Numbered Lists turn to Bullets
Copying a Numbered List from one document to another results in the pasted
List becoming a Bulleted List. However the Style of the pasted item is correct. If I select and apply the style it displays correctly. These documents are generated from another application and it is not optimum to have to hand correct each document. It does not seem possible to create a macro to select all instances of the style and apply the style. Also, why is it that the style is correctly identified but not updated? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Copy&Paste Numbered Lists turn to Bullets
If the paragraphs can be identified, then it is certainly possible to apply
the correct styles e.g. the following macro checks each paragraph and if a bullet or a number format is added to the underlying style, then those paragraphs are formatted with the List Number style. However I am unable to create the problem so I cannot check whether the solution posted here will work for you.. Dim oPars As Paragraphs Dim oPar As Paragraph Dim oRng As Range Set oPars = ActiveDocument.Paragraphs For Each oPar In ActiveDocument.Range.Paragraphs Set oRng = oPar.Range If oRng.ListFormat.ListType = _ wdListBullet Then oRng.Style = "List Number" End If If oRng.ListFormat.ListType = _ wdListSimpleNumbering Then oRng.Style = "List Number" End If Next oPar http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Geoff wrote: Copying a Numbered List from one document to another results in the pasted List becoming a Bulleted List. However the Style of the pasted item is correct. If I select and apply the style it displays correctly. These documents are generated from another application and it is not optimum to have to hand correct each document. It does not seem possible to create a macro to select all instances of the style and apply the style. Also, why is it that the style is correctly identified but not updated? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Copy&Paste Numbered Lists turn to Bullets
On further reflection, it might be better to process the text as you paste
it. The following version of the macro will paste the selected text and apply the List Number style to numbered/bulleted paragraphs in the process. Sub myPaste() Dim oPars As Paragraphs Dim oPar As Paragraph Dim oRng As Range Dim oPaste As Range Set oPaste = Selection.Range oPaste.Paste Set oPars = oPaste.Paragraphs For Each oPar In oPaste.Paragraphs Set oRng = oPar.Range 'The following four lines are probably superfluous 'If the copied text is numbered rather than bulleted 'If oRng.ListFormat.ListType = _ ' wdListBullet Then ' oRng.Style = "List Number" ' End If If oRng.ListFormat.ListType = _ wdListSimpleNumbering Then oRng.Style = "List Number" End If Next oPar End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: If the paragraphs can be identified, then it is certainly possible to apply the correct styles e.g. the following macro checks each paragraph and if a bullet or a number format is added to the underlying style, then those paragraphs are formatted with the List Number style. However I am unable to create the problem so I cannot check whether the solution posted here will work for you.. Dim oPars As Paragraphs Dim oPar As Paragraph Dim oRng As Range Set oPars = ActiveDocument.Paragraphs For Each oPar In ActiveDocument.Range.Paragraphs Set oRng = oPar.Range If oRng.ListFormat.ListType = _ wdListBullet Then oRng.Style = "List Number" End If If oRng.ListFormat.ListType = _ wdListSimpleNumbering Then oRng.Style = "List Number" End If Next oPar http://www.gmayor.com/installing_macro.htm Geoff wrote: Copying a Numbered List from one document to another results in the pasted List becoming a Bulleted List. However the Style of the pasted item is correct. If I select and apply the style it displays correctly. These documents are generated from another application and it is not optimum to have to hand correct each document. It does not seem possible to create a macro to select all instances of the style and apply the style. Also, why is it that the style is correctly identified but not updated? |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Copy&Paste Numbered Lists turn to Bullets
MVP Graham Mayor has posted the following macro to do what you are asking for
(his post is not yet visible in the Microsoft web interface): ************ Sub myPaste() Dim oPars As Paragraphs Dim oPar As Paragraph Dim oRng As Range Dim oPaste As Range Set oPaste = Selection.Range oPaste.Paste Set oPars = oPaste.Paragraphs For Each oPar In oPaste.Paragraphs Set oRng = oPar.Range 'The following four lines are probably superfluous 'If the copied text is numbered rather than bulleted 'If oRng.ListFormat.ListType = _ ' wdListBullet Then ' oRng.Style = "List Number" ' End If If oRng.ListFormat.ListType = _ wdListSimpleNumbering Then oRng.Style = "List Number" End If Next oPar End Sub ************ -- Stefan Blom Microsoft Word MVP "Geoff" wrote: Copying a Numbered List from one document to another results in the pasted List becoming a Bulleted List. However the Style of the pasted item is correct. If I select and apply the style it displays correctly. These documents are generated from another application and it is not optimum to have to hand correct each document. It does not seem possible to create a macro to select all instances of the style and apply the style. Also, why is it that the style is correctly identified but not updated? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
When I copy & paste into word text is automatically numbered. | Microsoft Word Help | |||
How do I copy bullets from Word and paste into other programs? | Microsoft Word Help | |||
Bullets/numbered lists grayed out | Microsoft Word Help | |||
bullets and numbered lists apply to ALL styles | Microsoft Word Help | |||
How do I turn off the automatic indenting of numbered lists? | Microsoft Word Help |