Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Geoff Geoff is offline
external usenet poster
 
Posts: 35
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
When I copy & paste into word text is automatically numbered. meshyrain Microsoft Word Help 1 January 31st 08 10:27 AM
How do I copy bullets from Word and paste into other programs? Melissa Microsoft Word Help 1 August 9th 07 10:21 PM
Bullets/numbered lists grayed out ggo247 Microsoft Word Help 3 January 4th 07 06:35 PM
bullets and numbered lists apply to ALL styles Mark at Icom Microsoft Word Help 3 May 26th 05 01:17 PM
How do I turn off the automatic indenting of numbered lists? Rigel Microsoft Word Help 2 April 27th 05 06:02 AM


All times are GMT +1. The time now is 08:32 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"