Hi! I need a VBA Macro that will process a selected section of text as
Quoted Text - similar to how email programs do it when you Reply to a Plain
Text message.

Basically, it needs to take a selected section of text and prefix every
line with a ">" character, whether the selected lines have a Line Break at
the end, or if they are simply wrapped around the next line.

Creating a Macro that prefixes a single line of text is easy:

-------------------------------

Sub QuoteLine()

Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=">"
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine

End Sub

---------------------------------


But I don't know how to alter this code so that it processes a selected
section of text.

Can anyone help?

Thanks!

Re: How to create Macro that will prefix all lines with a character? by Doug

Doug
Sat Jan 03 23:39:48 CST 2004

Hi Cumulous,

Probably the easiest way to do this is to save the section of text as a .txt
file, accepting the option to terminate each line with a carriage return,
and then to open the file again in Word and use Edit replace to replace each
^p with >^p.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
"Cumulous" <Cumulous128@yahoo.com> wrote in message
news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
>
> Hi! I need a VBA Macro that will process a selected section of text
as
> Quoted Text - similar to how email programs do it when you Reply to a
Plain
> Text message.
>
> Basically, it needs to take a selected section of text and prefix
every
> line with a ">" character, whether the selected lines have a Line Break at
> the end, or if they are simply wrapped around the next line.
>
> Creating a Macro that prefixes a single line of text is easy:
>
> -------------------------------
>
> Sub QuoteLine()
>
> Selection.HomeKey Unit:=wdLine
> Selection.TypeText Text:=">"
> Selection.MoveDown Unit:=wdLine, Count:=1
> Selection.HomeKey Unit:=wdLine
>
> End Sub
>
> ---------------------------------
>
>
> But I don't know how to alter this code so that it processes a
selected
> section of text.
>
> Can anyone help?
>
> Thanks!
>
>
>



Re: How to create Macro that will prefix all lines with a character? by Cumulous

Cumulous
Mon Jan 05 08:06:59 CST 2004


This is too unwieldy. Users need to do this for sections of text in the
middle of a document. They cannot start copy/pasting sections to a new
document, saving it under a different format, running a macro, copy/pasting
it back, etc.... Their productivity would grind to a screaching halt.

I can't imagine that this is such a hard thing to program. After all,
just about every email program in existence does this - including Outlook
(which uses Word to edit emails).

I have seen far more complex macros in use - is this one really so
difficult to produce?




Cumulous




"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS"
<dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
> Hi Cumulous,
>
> Probably the easiest way to do this is to save the section of text as a
.txt
> file, accepting the option to terminate each line with a carriage return,
> and then to open the file again in Word and use Edit replace to replace
each
> ^p with >^p.
>
> Please post any further questions or followup to the newsgroups for the
> benefit of others who may be interested. Unsolicited questions forwarded
> directly to me will only be answered on a paid consulting basis.
>
> Hope this helps
> Doug Robbins - Word MVP
> "Cumulous" <Cumulous128@yahoo.com> wrote in message
> news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
> >
> > Hi! I need a VBA Macro that will process a selected section of text
> as
> > Quoted Text - similar to how email programs do it when you Reply to a
> Plain
> > Text message.
> >
> > Basically, it needs to take a selected section of text and prefix
> every
> > line with a ">" character, whether the selected lines have a Line Break
at
> > the end, or if they are simply wrapped around the next line.
> >
> > Creating a Macro that prefixes a single line of text is easy:
> >
> > -------------------------------
> >
> > Sub QuoteLine()
> >
> > Selection.HomeKey Unit:=wdLine
> > Selection.TypeText Text:=">"
> > Selection.MoveDown Unit:=wdLine, Count:=1
> > Selection.HomeKey Unit:=wdLine
> >
> > End Sub
> >
> > ---------------------------------
> >
> >
> > But I don't know how to alter this code so that it processes a
> selected
> > section of text.
> >
> > Can anyone help?
> >
> > Thanks!
> >
> >
> >
>
>



Re: How to create Macro that will prefix all lines with a character? by Graham

Graham
Mon Jan 05 11:01:27 CST 2004

This is not as simple as you imagine, as there is no such thing as a 'line'
in Word. A line of text is an arbitrary entity determined by a variety of
factors, not least of which is the current printer driver, and adding your
character will screw up even that formatting; however, you can mark
individual 'lines' using the following bit of code, and if you assign the
macro to a keyboard shortcut or toolbar button, it is a simple process to
mark a block of text, line by line:

With Selection
.HomeKey Unit:=wdLine
.TypeText Text:=">"
.EndKey Unit:=wdLine
.TypeBackspace
.TypeParagraph
.MoveUp Unit:=wdLine, Count:=1
.Style = ActiveDocument.Styles("Normal")
.MoveDown Unit:=wdLine, Count:=1
End With

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail gmayor@mvps.org
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>


Cumulous wrote:
> This is too unwieldy. Users need to do this for sections of text
> in the middle of a document. They cannot start copy/pasting sections
> to a new document, saving it under a different format, running a
> macro, copy/pasting it back, etc.... Their productivity would grind
> to a screaching halt.
>
> I can't imagine that this is such a hard thing to program. After
> all, just about every email program in existence does this -
> including Outlook (which uses Word to edit emails).
>
> I have seen far more complex macros in use - is this one really so
> difficult to produce?
>
>
>
>
> Cumulous
>
>
>
>
> "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
> ADDRESS" <dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
> news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
>> Hi Cumulous,
>>
>> Probably the easiest way to do this is to save the section of text
>> as a .txt file, accepting the option to terminate each line with a
>> carriage return, and then to open the file again in Word and use
>> Edit replace to replace each ^p with >^p.
>>
>> Please post any further questions or followup to the newsgroups for
>> the benefit of others who may be interested. Unsolicited questions
>> forwarded directly to me will only be answered on a paid consulting
>> basis.
>>
>> Hope this helps
>> Doug Robbins - Word MVP
>> "Cumulous" <Cumulous128@yahoo.com> wrote in message
>> news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
>>>
>>> Hi! I need a VBA Macro that will process a selected section of
>>> text as Quoted Text - similar to how email programs do it when you
>>> Reply to a Plain Text message.
>>>
>>> Basically, it needs to take a selected section of text and
>>> prefix every line with a ">" character, whether the selected lines
>>> have a Line Break at the end, or if they are simply wrapped around
>>> the next line.
>>>
>>> Creating a Macro that prefixes a single line of text is easy:
>>>
>>> -------------------------------
>>>
>>> Sub QuoteLine()
>>>
>>> Selection.HomeKey Unit:=wdLine
>>> Selection.TypeText Text:=">"
>>> Selection.MoveDown Unit:=wdLine, Count:=1
>>> Selection.HomeKey Unit:=wdLine
>>>
>>> End Sub
>>>
>>> ---------------------------------
>>>
>>>
>>> But I don't know how to alter this code so that it processes a
>>> selected section of text.
>>>
>>> Can anyone help?
>>>
>>> Thanks!



Re: How to create Macro that will prefix all lines with a character? by Lars-Eric

Lars-Eric
Mon Jan 05 11:06:13 CST 2004

Cumulous,

Try this code as a starting point:

Sub PreFixLines()
Dim oRng As Range

Set oRng = Selection.Range

Selection.Collapse

While Selection.Range.End < oRng.End
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
If Asc(Selection.Text) <> 13 Then
Selection.HomeKey Unit:=wdLine
Selection.TypeText "> "
' Must add a line break so the prefix will not
' be moved to the end of the previous line
Selection.EndKey Unit:=wdLine
Selection.TypeText Chr(11)
Else
' Empty line with just a paragraph mark
Selection.HomeKey Unit:=wdLine
Selection.TypeText "> "
Selection.MoveDown
End If
Wend
End Sub

--
Regards,
Lars-Eric Gisslén


"Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
news:eFzpwU50DHA.1576@TK2MSFTNGP11.phx.gbl...
>
> This is too unwieldy. Users need to do this for sections of text in
the
> middle of a document. They cannot start copy/pasting sections to a new
> document, saving it under a different format, running a macro,
copy/pasting
> it back, etc.... Their productivity would grind to a screaching halt.
>
> I can't imagine that this is such a hard thing to program. After all,
> just about every email program in existence does this - including Outlook
> (which uses Word to edit emails).
>
> I have seen far more complex macros in use - is this one really so
> difficult to produce?
>
>
>
>
> Cumulous
>
>
>
>
> "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS"
> <dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
> news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
> > Hi Cumulous,
> >
> > Probably the easiest way to do this is to save the section of text as a
> .txt
> > file, accepting the option to terminate each line with a carriage
return,
> > and then to open the file again in Word and use Edit replace to replace
> each
> > ^p with >^p.
> >
> > Please post any further questions or followup to the newsgroups for the
> > benefit of others who may be interested. Unsolicited questions
forwarded
> > directly to me will only be answered on a paid consulting basis.
> >
> > Hope this helps
> > Doug Robbins - Word MVP
> > "Cumulous" <Cumulous128@yahoo.com> wrote in message
> > news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
> > >
> > > Hi! I need a VBA Macro that will process a selected section of
text
> > as
> > > Quoted Text - similar to how email programs do it when you Reply to a
> > Plain
> > > Text message.
> > >
> > > Basically, it needs to take a selected section of text and prefix
> > every
> > > line with a ">" character, whether the selected lines have a Line
Break
> at
> > > the end, or if they are simply wrapped around the next line.
> > >
> > > Creating a Macro that prefixes a single line of text is easy:
> > >
> > > -------------------------------
> > >
> > > Sub QuoteLine()
> > >
> > > Selection.HomeKey Unit:=wdLine
> > > Selection.TypeText Text:=">"
> > > Selection.MoveDown Unit:=wdLine, Count:=1
> > > Selection.HomeKey Unit:=wdLine
> > >
> > > End Sub
> > >
> > > ---------------------------------
> > >
> > >
> > > But I don't know how to alter this code so that it processes a
> > selected
> > > section of text.
> > >
> > > Can anyone help?
> > >
> > > Thanks!
> > >
> > >
> > >
> >
> >
>
>



Re: How to create Macro that will prefix all lines with a character? by Cumulous

Cumulous
Mon Jan 05 15:19:28 CST 2004


The code sample I quoted in my initial message is able to process a
single line. What I need is a macro that will process an entire selected
block of text.

As for your mentioning that there is no such thing as a "line" in Word -
I understand where you are coming from. However, Word is able to understand
the concept because it's right there in the Status Bar on the bottom of the
screen "Ln X" where X is the line you are on. This has nothing to do with
Line Breaks, but simply the visual structure of the document itself as it is
displayed at that moment.

Therefore, is it not possible to write a macro that basically does this
(in plain text instructions):

1. Go to the first line in the selected block of text.
2. Enter "Home Key", "> ", "Down Arrow", "Home Key"
3. Repeat until you reach the bottom of the selected block of text.
4. End Macro


That doesn't seem like it should be that impossible. I have the
structure to enter the keys and text that are listed in Step 2. I just don't
know how to implement the processing of a selected block of text.

It has to be possible somehow - even if it's some form of:

1. Set FirstLine to the Line Number of the first line in the selection
2. Set LastLine to the Line Number of the last line in the selection
3. Set TotalLines to (LastLine - FirstLine)
4. And then start implementing Step 2 from the first section above while
incrementing a counter until you have reached what should be the last line.


It can't be impossible, if Outlook can do it, can it?



Cumulous



"Graham Mayor" <gmayor@mvps.org> wrote in message
news:uqABS260DHA.2156@TK2MSFTNGP12.phx.gbl...
> This is not as simple as you imagine, as there is no such thing as a
'line'
> in Word. A line of text is an arbitrary entity determined by a variety of
> factors, not least of which is the current printer driver, and adding your
> character will screw up even that formatting; however, you can mark
> individual 'lines' using the following bit of code, and if you assign the
> macro to a keyboard shortcut or toolbar button, it is a simple process to
> mark a block of text, line by line:
>
> With Selection
> .HomeKey Unit:=wdLine
> .TypeText Text:=">"
> .EndKey Unit:=wdLine
> .TypeBackspace
> .TypeParagraph
> .MoveUp Unit:=wdLine, Count:=1
> .Style = ActiveDocument.Styles("Normal")
> .MoveDown Unit:=wdLine, Count:=1
> End With
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
> Graham Mayor - Word MVP
> E-mail gmayor@mvps.org
> Web site www.gmayor.com
> Word MVP web site www.mvps.org/word
> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
>
>
> Cumulous wrote:
> > This is too unwieldy. Users need to do this for sections of text
> > in the middle of a document. They cannot start copy/pasting sections
> > to a new document, saving it under a different format, running a
> > macro, copy/pasting it back, etc.... Their productivity would grind
> > to a screaching halt.
> >
> > I can't imagine that this is such a hard thing to program. After
> > all, just about every email program in existence does this -
> > including Outlook (which uses Word to edit emails).
> >
> > I have seen far more complex macros in use - is this one really so
> > difficult to produce?
> >
> >
> >
> >
> > Cumulous
> >
> >
> >
> >
> > "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
> > ADDRESS" <dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
> > news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
> >> Hi Cumulous,
> >>
> >> Probably the easiest way to do this is to save the section of text
> >> as a .txt file, accepting the option to terminate each line with a
> >> carriage return, and then to open the file again in Word and use
> >> Edit replace to replace each ^p with >^p.
> >>
> >> Please post any further questions or followup to the newsgroups for
> >> the benefit of others who may be interested. Unsolicited questions
> >> forwarded directly to me will only be answered on a paid consulting
> >> basis.
> >>
> >> Hope this helps
> >> Doug Robbins - Word MVP
> >> "Cumulous" <Cumulous128@yahoo.com> wrote in message
> >> news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
> >>>
> >>> Hi! I need a VBA Macro that will process a selected section of
> >>> text as Quoted Text - similar to how email programs do it when you
> >>> Reply to a Plain Text message.
> >>>
> >>> Basically, it needs to take a selected section of text and
> >>> prefix every line with a ">" character, whether the selected lines
> >>> have a Line Break at the end, or if they are simply wrapped around
> >>> the next line.
> >>>
> >>> Creating a Macro that prefixes a single line of text is easy:
> >>>
> >>> -------------------------------
> >>>
> >>> Sub QuoteLine()
> >>>
> >>> Selection.HomeKey Unit:=wdLine
> >>> Selection.TypeText Text:=">"
> >>> Selection.MoveDown Unit:=wdLine, Count:=1
> >>> Selection.HomeKey Unit:=wdLine
> >>>
> >>> End Sub
> >>>
> >>> ---------------------------------
> >>>
> >>>
> >>> But I don't know how to alter this code so that it processes a
> >>> selected section of text.
> >>>
> >>> Can anyone help?
> >>>
> >>> Thanks!
>
>



Re: How to create Macro that will prefix all lines with a character? by Cumulous

Cumulous
Mon Jan 05 15:20:33 CST 2004



When I try that code in Word 2003, I get an endless cycle of blank lines
with just the ">" character until Word crashes.



Cumulous



"Lars-Eric Gisslén" <nowhere@inter.net> wrote in message
news:O5zbU260DHA.1188@TK2MSFTNGP11.phx.gbl...
> Cumulous,
>
> Try this code as a starting point:
>
> Sub PreFixLines()
> Dim oRng As Range
>
> Set oRng = Selection.Range
>
> Selection.Collapse
>
> While Selection.Range.End < oRng.End
> Selection.HomeKey Unit:=wdLine
> Selection.EndKey Unit:=wdLine, Extend:=wdExtend
> If Asc(Selection.Text) <> 13 Then
> Selection.HomeKey Unit:=wdLine
> Selection.TypeText "> "
> ' Must add a line break so the prefix will not
> ' be moved to the end of the previous line
> Selection.EndKey Unit:=wdLine
> Selection.TypeText Chr(11)
> Else
> ' Empty line with just a paragraph mark
> Selection.HomeKey Unit:=wdLine
> Selection.TypeText "> "
> Selection.MoveDown
> End If
> Wend
> End Sub
>
> --
> Regards,
> Lars-Eric Gisslén
>
>
> "Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
> news:eFzpwU50DHA.1576@TK2MSFTNGP11.phx.gbl...
> >
> > This is too unwieldy. Users need to do this for sections of text in
> the
> > middle of a document. They cannot start copy/pasting sections to a new
> > document, saving it under a different format, running a macro,
> copy/pasting
> > it back, etc.... Their productivity would grind to a screaching halt.
> >
> > I can't imagine that this is such a hard thing to program. After
all,
> > just about every email program in existence does this - including
Outlook
> > (which uses Word to edit emails).
> >
> > I have seen far more complex macros in use - is this one really so
> > difficult to produce?
> >
> >
> >
> >
> > Cumulous
> >
> >
> >
> >
> > "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
ADDRESS"
> > <dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
> > news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
> > > Hi Cumulous,
> > >
> > > Probably the easiest way to do this is to save the section of text as
a
> > .txt
> > > file, accepting the option to terminate each line with a carriage
> return,
> > > and then to open the file again in Word and use Edit replace to
replace
> > each
> > > ^p with >^p.
> > >
> > > Please post any further questions or followup to the newsgroups for
the
> > > benefit of others who may be interested. Unsolicited questions
> forwarded
> > > directly to me will only be answered on a paid consulting basis.
> > >
> > > Hope this helps
> > > Doug Robbins - Word MVP
> > > "Cumulous" <Cumulous128@yahoo.com> wrote in message
> > > news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
> > > >
> > > > Hi! I need a VBA Macro that will process a selected section of
> text
> > > as
> > > > Quoted Text - similar to how email programs do it when you Reply to
a
> > > Plain
> > > > Text message.
> > > >
> > > > Basically, it needs to take a selected section of text and
prefix
> > > every
> > > > line with a ">" character, whether the selected lines have a Line
> Break
> > at
> > > > the end, or if they are simply wrapped around the next line.
> > > >
> > > > Creating a Macro that prefixes a single line of text is easy:
> > > >
> > > > -------------------------------
> > > >
> > > > Sub QuoteLine()
> > > >
> > > > Selection.HomeKey Unit:=wdLine
> > > > Selection.TypeText Text:=">"
> > > > Selection.MoveDown Unit:=wdLine, Count:=1
> > > > Selection.HomeKey Unit:=wdLine
> > > >
> > > > End Sub
> > > >
> > > > ---------------------------------
> > > >
> > > >
> > > > But I don't know how to alter this code so that it processes a
> > > selected
> > > > section of text.
> > > >
> > > > Can anyone help?
> > > >
> > > > Thanks!
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: How to create Macro that will prefix all lines with a character? by Lars-Eric

Lars-Eric
Mon Jan 05 19:44:20 CST 2004

Cumulous,

Works for me on both Word 2000 and 2003. Have you tried to set a break point
in the code and step through it and verify where the problem is?

--
Regards,
Lars-Eric Gisslén

"Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
news:%231sdCH90DHA.2116@TK2MSFTNGP10.phx.gbl...
>
>
> When I try that code in Word 2003, I get an endless cycle of blank
lines
> with just the ">" character until Word crashes.
>
>
>
> Cumulous
>
>
>
> "Lars-Eric Gisslén" <nowhere@inter.net> wrote in message
> news:O5zbU260DHA.1188@TK2MSFTNGP11.phx.gbl...
> > Cumulous,
> >
> > Try this code as a starting point:
> >
> > Sub PreFixLines()
> > Dim oRng As Range
> >
> > Set oRng = Selection.Range
> >
> > Selection.Collapse
> >
> > While Selection.Range.End < oRng.End
> > Selection.HomeKey Unit:=wdLine
> > Selection.EndKey Unit:=wdLine, Extend:=wdExtend
> > If Asc(Selection.Text) <> 13 Then
> > Selection.HomeKey Unit:=wdLine
> > Selection.TypeText "> "
> > ' Must add a line break so the prefix will not
> > ' be moved to the end of the previous line
> > Selection.EndKey Unit:=wdLine
> > Selection.TypeText Chr(11)
> > Else
> > ' Empty line with just a paragraph mark
> > Selection.HomeKey Unit:=wdLine
> > Selection.TypeText "> "
> > Selection.MoveDown
> > End If
> > Wend
> > End Sub
> >
> > --
> > Regards,
> > Lars-Eric Gisslén
> >
> >
> > "Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
> > news:eFzpwU50DHA.1576@TK2MSFTNGP11.phx.gbl...
> > >
> > > This is too unwieldy. Users need to do this for sections of text
in
> > the
> > > middle of a document. They cannot start copy/pasting sections to a
new
> > > document, saving it under a different format, running a macro,
> > copy/pasting
> > > it back, etc.... Their productivity would grind to a screaching
halt.
> > >
> > > I can't imagine that this is such a hard thing to program. After
> all,
> > > just about every email program in existence does this - including
> Outlook
> > > (which uses Word to edit emails).
> > >
> > > I have seen far more complex macros in use - is this one really so
> > > difficult to produce?
> > >
> > >
> > >
> > >
> > > Cumulous
> > >
> > >
> > >
> > >
> > > "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
> ADDRESS"
> > > <dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
> > > news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
> > > > Hi Cumulous,
> > > >
> > > > Probably the easiest way to do this is to save the section of text
as
> a
> > > .txt
> > > > file, accepting the option to terminate each line with a carriage
> > return,
> > > > and then to open the file again in Word and use Edit replace to
> replace
> > > each
> > > > ^p with >^p.
> > > >
> > > > Please post any further questions or followup to the newsgroups for
> the
> > > > benefit of others who may be interested. Unsolicited questions
> > forwarded
> > > > directly to me will only be answered on a paid consulting basis.
> > > >
> > > > Hope this helps
> > > > Doug Robbins - Word MVP
> > > > "Cumulous" <Cumulous128@yahoo.com> wrote in message
> > > > news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
> > > > >
> > > > > Hi! I need a VBA Macro that will process a selected section
of
> > text
> > > > as
> > > > > Quoted Text - similar to how email programs do it when you Reply
to
> a
> > > > Plain
> > > > > Text message.
> > > > >
> > > > > Basically, it needs to take a selected section of text and
> prefix
> > > > every
> > > > > line with a ">" character, whether the selected lines have a Line
> > Break
> > > at
> > > > > the end, or if they are simply wrapped around the next line.
> > > > >
> > > > > Creating a Macro that prefixes a single line of text is easy:
> > > > >
> > > > > -------------------------------
> > > > >
> > > > > Sub QuoteLine()
> > > > >
> > > > > Selection.HomeKey Unit:=wdLine
> > > > > Selection.TypeText Text:=">"
> > > > > Selection.MoveDown Unit:=wdLine, Count:=1
> > > > > Selection.HomeKey Unit:=wdLine
> > > > >
> > > > > End Sub
> > > > >
> > > > > ---------------------------------
> > > > >
> > > > >
> > > > > But I don't know how to alter this code so that it processes a
> > > > selected
> > > > > section of text.
> > > > >
> > > > > Can anyone help?
> > > > >
> > > > > Thanks!
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: How to create Macro that will prefix all lines with a character? by Cumulous

Cumulous
Mon Jan 05 23:06:08 CST 2004



Here is what your code is doing:

1. I start off by selecting a section of text. Then I run the macro.

2. The cursor goes to the beginning of the first line and adds "> ".

3. The cursor then goes to the end of the line.

4. An empty line is added.

5. The empty line is selected.

6. The cursor goes to the beginning of the EMPTY line that was just added
and adds "> ".

7. Steps 4-6 repeat endlessly.




Cumulous




"Lars-Eric Gisslén" <nowhere@inter.net> wrote in message
news:uJss1X$0DHA.2972@TK2MSFTNGP09.phx.gbl...
> Cumulous,
>
> Works for me on both Word 2000 and 2003. Have you tried to set a break
point
> in the code and step through it and verify where the problem is?
>
> --
> Regards,
> Lars-Eric Gisslén
>
> "Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
> news:%231sdCH90DHA.2116@TK2MSFTNGP10.phx.gbl...
> >
> >
> > When I try that code in Word 2003, I get an endless cycle of blank
> lines
> > with just the ">" character until Word crashes.
> >
> >
> >
> > Cumulous
> >
> >
> >
> > "Lars-Eric Gisslén" <nowhere@inter.net> wrote in message
> > news:O5zbU260DHA.1188@TK2MSFTNGP11.phx.gbl...
> > > Cumulous,
> > >
> > > Try this code as a starting point:
> > >
> > > Sub PreFixLines()
> > > Dim oRng As Range
> > >
> > > Set oRng = Selection.Range
> > >
> > > Selection.Collapse
> > >
> > > While Selection.Range.End < oRng.End
> > > Selection.HomeKey Unit:=wdLine
> > > Selection.EndKey Unit:=wdLine, Extend:=wdExtend
> > > If Asc(Selection.Text) <> 13 Then
> > > Selection.HomeKey Unit:=wdLine
> > > Selection.TypeText "> "
> > > ' Must add a line break so the prefix will not
> > > ' be moved to the end of the previous line
> > > Selection.EndKey Unit:=wdLine
> > > Selection.TypeText Chr(11)
> > > Else
> > > ' Empty line with just a paragraph mark
> > > Selection.HomeKey Unit:=wdLine
> > > Selection.TypeText "> "
> > > Selection.MoveDown
> > > End If
> > > Wend
> > > End Sub
> > >
> > > --
> > > Regards,
> > > Lars-Eric Gisslén
> > >
> > >
> > > "Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
> > > news:eFzpwU50DHA.1576@TK2MSFTNGP11.phx.gbl...
> > > >
> > > > This is too unwieldy. Users need to do this for sections of
text
> in
> > > the
> > > > middle of a document. They cannot start copy/pasting sections to a
> new
> > > > document, saving it under a different format, running a macro,
> > > copy/pasting
> > > > it back, etc.... Their productivity would grind to a screaching
> halt.
> > > >
> > > > I can't imagine that this is such a hard thing to program.
After
> > all,
> > > > just about every email program in existence does this - including
> > Outlook
> > > > (which uses Word to edit emails).
> > > >
> > > > I have seen far more complex macros in use - is this one really
so
> > > > difficult to produce?
> > > >
> > > >
> > > >
> > > >
> > > > Cumulous
> > > >
> > > >
> > > >
> > > >
> > > > "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
> > ADDRESS"
> > > > <dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
> > > > news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
> > > > > Hi Cumulous,
> > > > >
> > > > > Probably the easiest way to do this is to save the section of text
> as
> > a
> > > > .txt
> > > > > file, accepting the option to terminate each line with a carriage
> > > return,
> > > > > and then to open the file again in Word and use Edit replace to
> > replace
> > > > each
> > > > > ^p with >^p.
> > > > >
> > > > > Please post any further questions or followup to the newsgroups
for
> > the
> > > > > benefit of others who may be interested. Unsolicited questions
> > > forwarded
> > > > > directly to me will only be answered on a paid consulting basis.
> > > > >
> > > > > Hope this helps
> > > > > Doug Robbins - Word MVP
> > > > > "Cumulous" <Cumulous128@yahoo.com> wrote in message
> > > > > news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
> > > > > >
> > > > > > Hi! I need a VBA Macro that will process a selected section
> of
> > > text
> > > > > as
> > > > > > Quoted Text - similar to how email programs do it when you Reply
> to
> > a
> > > > > Plain
> > > > > > Text message.
> > > > > >
> > > > > > Basically, it needs to take a selected section of text and
> > prefix
> > > > > every
> > > > > > line with a ">" character, whether the selected lines have a
Line
> > > Break
> > > > at
> > > > > > the end, or if they are simply wrapped around the next line.
> > > > > >
> > > > > > Creating a Macro that prefixes a single line of text is
easy:
> > > > > >
> > > > > > -------------------------------
> > > > > >
> > > > > > Sub QuoteLine()
> > > > > >
> > > > > > Selection.HomeKey Unit:=wdLine
> > > > > > Selection.TypeText Text:=">"
> > > > > > Selection.MoveDown Unit:=wdLine, Count:=1
> > > > > > Selection.HomeKey Unit:=wdLine
> > > > > >
> > > > > > End Sub
> > > > > >
> > > > > > ---------------------------------
> > > > > >
> > > > > >
> > > > > > But I don't know how to alter this code so that it processes
a
> > > > > selected
> > > > > > section of text.
> > > > > >
> > > > > > Can anyone help?
> > > > > >
> > > > > > Thanks!
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: How to create Macro that will prefix all lines with a character? by Doug

Doug
Tue Jan 06 03:57:41 CST 2004

If that is the case, each line of your text must already be terminated with
a carriage return or a manual line break.

The following modified macro should work, though you may end up with a
couple of lines that wrap without the > added to the front of them. It
therefore maybe best to strip off all of the carriage returns or manual line
breaks at the end of the line so that you are dealing with "word-wrapped"
text.

Sub PreFixLines()
Dim oRng As Range
Set oRng = Selection.Range
Selection.Collapse
While Selection.Range.End < oRng.End
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
If Asc(Selection.Text) <> 13 Then
Selection.HomeKey Unit:=wdLine
Selection.TypeText "> "
' Must add a line break so the prefix will not
' be moved to the end of the previous line
'Selection.EndKey Unit:=wdLine
'Selection.TypeText Chr(11)
Selection.MoveDown
Selection.HomeKey Unit:=wdLine
Else
' Empty line with just a paragraph mark
Selection.HomeKey Unit:=wdLine
Selection.TypeText "> "
Selection.MoveDown
End If
Wend
End Sub


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
"Cumulous" <Cumulous128@yahoo.com> wrote in message
news:O541LLB1DHA.1336@TK2MSFTNGP12.phx.gbl...
>
>
> Here is what your code is doing:
>
> 1. I start off by selecting a section of text. Then I run the macro.
>
> 2. The cursor goes to the beginning of the first line and adds "> ".
>
> 3. The cursor then goes to the end of the line.
>
> 4. An empty line is added.
>
> 5. The empty line is selected.
>
> 6. The cursor goes to the beginning of the EMPTY line that was just added
> and adds "> ".
>
> 7. Steps 4-6 repeat endlessly.
>
>
>
>
> Cumulous
>
>
>
>
> "Lars-Eric Gisslén" <nowhere@inter.net> wrote in message
> news:uJss1X$0DHA.2972@TK2MSFTNGP09.phx.gbl...
>> Cumulous,
>>
>> Works for me on both Word 2000 and 2003. Have you tried to set a break
> point
>> in the code and step through it and verify where the problem is?
>>
>> --
>> Regards,
>> Lars-Eric Gisslén
>>
>> "Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
>> news:%231sdCH90DHA.2116@TK2MSFTNGP10.phx.gbl...
>> >
>> >
>> > When I try that code in Word 2003, I get an endless cycle of blank
>> lines
>> > with just the ">" character until Word crashes.
>> >
>> >
>> >
>> > Cumulous
>> >
>> >
>> >
>> > "Lars-Eric Gisslén" <nowhere@inter.net> wrote in message
>> > news:O5zbU260DHA.1188@TK2MSFTNGP11.phx.gbl...
>> > > Cumulous,
>> > >
>> > > Try this code as a starting point:
>> > >
>> > > Sub PreFixLines()
>> > > Dim oRng As Range
>> > >
>> > > Set oRng = Selection.Range
>> > >
>> > > Selection.Collapse
>> > >
>> > > While Selection.Range.End < oRng.End
>> > > Selection.HomeKey Unit:=wdLine
>> > > Selection.EndKey Unit:=wdLine, Extend:=wdExtend
>> > > If Asc(Selection.Text) <> 13 Then
>> > > Selection.HomeKey Unit:=wdLine
>> > > Selection.TypeText "> "
>> > > ' Must add a line break so the prefix will not
>> > > ' be moved to the end of the previous line
>> > > Selection.EndKey Unit:=wdLine
>> > > Selection.TypeText Chr(11)
>> > > Else
>> > > ' Empty line with just a paragraph mark
>> > > Selection.HomeKey Unit:=wdLine
>> > > Selection.TypeText "> "
>> > > Selection.MoveDown
>> > > End If
>> > > Wend
>> > > End Sub
>> > >
>> > > --
>> > > Regards,
>> > > Lars-Eric Gisslén
>> > >
>> > >
>> > > "Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
>> > > news:eFzpwU50DHA.1576@TK2MSFTNGP11.phx.gbl...
>> > > >
>> > > > This is too unwieldy. Users need to do this for sections of
> text
>> in
>> > > the
>> > > > middle of a document. They cannot start copy/pasting sections to a
>> new
>> > > > document, saving it under a different format, running a macro,
>> > > copy/pasting
>> > > > it back, etc.... Their productivity would grind to a screaching
>> halt.
>> > > >
>> > > > I can't imagine that this is such a hard thing to program.
> After
>> > all,
>> > > > just about every email program in existence does this - including
>> > Outlook
>> > > > (which uses Word to edit emails).
>> > > >
>> > > > I have seen far more complex macros in use - is this one really
> so
>> > > > difficult to produce?
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > Cumulous
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
>> > ADDRESS"
>> > > > <dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
>> > > > news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
>> > > > > Hi Cumulous,
>> > > > >
>> > > > > Probably the easiest way to do this is to save the section of
>> > > > > text
>> as
>> > a
>> > > > .txt
>> > > > > file, accepting the option to terminate each line with a carriage
>> > > return,
>> > > > > and then to open the file again in Word and use Edit replace to
>> > replace
>> > > > each
>> > > > > ^p with >^p.
>> > > > >
>> > > > > Please post any further questions or followup to the newsgroups
> for
>> > the
>> > > > > benefit of others who may be interested. Unsolicited questions
>> > > forwarded
>> > > > > directly to me will only be answered on a paid consulting basis.
>> > > > >
>> > > > > Hope this helps
>> > > > > Doug Robbins - Word MVP
>> > > > > "Cumulous" <Cumulous128@yahoo.com> wrote in message
>> > > > > news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
>> > > > > >
>> > > > > > Hi! I need a VBA Macro that will process a selected
>> > > > > > section
>> of
>> > > text
>> > > > > as
>> > > > > > Quoted Text - similar to how email programs do it when you
>> > > > > > Reply
>> to
>> > a
>> > > > > Plain
>> > > > > > Text message.
>> > > > > >
>> > > > > > Basically, it needs to take a selected section of text and
>> > prefix
>> > > > > every
>> > > > > > line with a ">" character, whether the selected lines have a
> Line
>> > > Break
>> > > > at
>> > > > > > the end, or if they are simply wrapped around the next line.
>> > > > > >
>> > > > > > Creating a Macro that prefixes a single line of text is
> easy:
>> > > > > >
>> > > > > > -------------------------------
>> > > > > >
>> > > > > > Sub QuoteLine()
>> > > > > >
>> > > > > > Selection.HomeKey Unit:=wdLine
>> > > > > > Selection.TypeText Text:=">"
>> > > > > > Selection.MoveDown Unit:=wdLine, Count:=1
>> > > > > > Selection.HomeKey Unit:=wdLine
>> > > > > >
>> > > > > > End Sub
>> > > > > >
>> > > > > > ---------------------------------
>> > > > > >
>> > > > > >
>> > > > > > But I don't know how to alter this code so that it
>> > > > > > processes
> a
>> > > > > selected
>> > > > > > section of text.
>> > > > > >
>> > > > > > Can anyone help?
>> > > > > >
>> > > > > > Thanks!
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > >
>> > >
>> >
>> >
>>
>>
>
>



Re: How to create Macro that will prefix all lines with a character? by Graham

Graham
Tue Jan 06 06:54:39 CST 2004

The code pre-supposes that your document is formatted in paragraphs each of
which occupies more than one line, and it is in the paragraphs where the
problems lie. If the text comprises a range of lines each terminated with a
paragraph mark (or line feed mark) then the job is somewhat simpler and can
be handled in the way you require. However, the conversation has moved on
while I have been sleeping and the later suggestions should do what you
require.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail gmayor@mvps.org
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>


Cumulous wrote:
> The code sample I quoted in my initial message is able to process
> a single line. What I need is a macro that will process an entire
> selected block of text.
>
> As for your mentioning that there is no such thing as a "line" in
> Word - I understand where you are coming from. However, Word is able
> to understand the concept because it's right there in the Status Bar
> on the bottom of the screen "Ln X" where X is the line you are on.
> This has nothing to do with Line Breaks, but simply the visual
> structure of the document itself as it is displayed at that moment.
>
> Therefore, is it not possible to write a macro that basically
> does this (in plain text instructions):
>
> 1. Go to the first line in the selected block of text.
> 2. Enter "Home Key", "> ", "Down Arrow", "Home Key"
> 3. Repeat until you reach the bottom of the selected block of text.
> 4. End Macro
>
>
> That doesn't seem like it should be that impossible. I have the
> structure to enter the keys and text that are listed in Step 2. I
> just don't know how to implement the processing of a selected block
> of text.
>
> It has to be possible somehow - even if it's some form of:
>
> 1. Set FirstLine to the Line Number of the first line in the
> selection
> 2. Set LastLine to the Line Number of the last line in the selection
> 3. Set TotalLines to (LastLine - FirstLine)
> 4. And then start implementing Step 2 from the first section above
> while incrementing a counter until you have reached what should be
> the last line.
>
>
> It can't be impossible, if Outlook can do it, can it?
>
>
>
> Cumulous
>
>
>
> "Graham Mayor" <gmayor@mvps.org> wrote in message
> news:uqABS260DHA.2156@TK2MSFTNGP12.phx.gbl...
>> This is not as simple as you imagine, as there is no such thing as a
>> 'line' in Word. A line of text is an arbitrary entity determined by
>> a variety of factors, not least of which is the current printer
>> driver, and adding your character will screw up even that
>> formatting; however, you can mark individual 'lines' using the
>> following bit of code, and if you assign the macro to a keyboard
>> shortcut or toolbar button, it is a simple process to mark a block
>> of text, line by line:
>>
>> With Selection
>> .HomeKey Unit:=wdLine
>> .TypeText Text:=">"
>> .EndKey Unit:=wdLine
>> .TypeBackspace
>> .TypeParagraph
>> .MoveUp Unit:=wdLine, Count:=1
>> .Style = ActiveDocument.Styles("Normal")
>> .MoveDown Unit:=wdLine, Count:=1
>> End With
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
>> Graham Mayor - Word MVP
>> E-mail gmayor@mvps.org
>> Web site www.gmayor.com
>> Word MVP web site www.mvps.org/word
>> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
>>
>>
>> Cumulous wrote:
>>> This is too unwieldy. Users need to do this for sections of
>>> text in the middle of a document. They cannot start copy/pasting
>>> sections to a new document, saving it under a different format,
>>> running a
>>> macro, copy/pasting it back, etc.... Their productivity would
>>> grind to a screaching halt.
>>>
>>> I can't imagine that this is such a hard thing to program.
>>> After all, just about every email program in existence does this -
>>> including Outlook (which uses Word to edit emails).
>>>
>>> I have seen far more complex macros in use - is this one really
>>> so difficult to produce?
>>>
>>>
>>>
>>>
>>> Cumulous
>>>
>>>
>>>
>>>
>>> "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
>>> ADDRESS" <dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
>>> news:%23sQlrUo0DHA.1668@TK2MSFTNGP10.phx.gbl...
>>>> Hi Cumulous,
>>>>
>>>> Probably the easiest way to do this is to save the section of text
>>>> as a .txt file, accepting the option to terminate each line with a
>>>> carriage return, and then to open the file again in Word and use
>>>> Edit replace to replace each ^p with >^p.
>>>>
>>>> Please post any further questions or followup to the newsgroups for
>>>> the benefit of others who may be interested. Unsolicited questions
>>>> forwarded directly to me will only be answered on a paid consulting
>>>> basis.
>>>>
>>>> Hope this helps
>>>> Doug Robbins - Word MVP
>>>> "Cumulous" <Cumulous128@yahoo.com> wrote in message
>>>> news:%23%23vOXkj0DHA.1744@TK2MSFTNGP12.phx.gbl...
>>>>>
>>>>> Hi! I need a VBA Macro that will process a selected section
>>>>> of text as Quoted Text - similar to how email programs do it when
>>>>> you Reply to a Plain Text message.
>>>>>
>>>>> Basically, it needs to take a selected section of text and
>>>>> prefix every line with a ">" character, whether the selected lines
>>>>> have a Line Break at the end, or if they are simply wrapped around
>>>>> the next line.
>>>>>
>>>>> Creating a Macro that prefixes a single line of text is easy:
>>>>>
>>>>> -------------------------------
>>>>>
>>>>> Sub QuoteLine()
>>>>>
>>>>> Selection.HomeKey Unit:=wdLine
>>>>> Selection.TypeText Text:=">"
>>>>> Selection.MoveDown Unit:=wdLine, Count:=1
>>>>> Selection.HomeKey Unit:=wdLine
>>>>>
>>>>> End Sub
>>>>>
>>>>> ---------------------------------
>>>>>
>>>>>
>>>>> But I don't know how to alter this code so that it processes a
>>>>> selected section of text.
>>>>>
>>>>> Can anyone help?
>>>>>
>>>>> Thanks!



Re: How to create Macro that will prefix all lines with a character? by Cumulous

Cumulous
Tue Jan 06 08:20:58 CST 2004


Ah! Now that does the job nicely. I don't mind needing to adjust for
the odd line break. That, I could code in. But that modified bit of code
is exactly what I needed to fill the void in my limited coding knowledge.

Thank you, Doug!



Cumulous



"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS"
<dkr@mOSTvALUABLEpROFESSIONALs.org> wrote in message
news:uAz7GuD1DHA.1684@TK2MSFTNGP12.phx.gbl...
> If that is the case, each line of your text must already be terminated
with
> a carriage return or a manual line break.
>
> The following modified macro should work, though you may end up with a
> couple of lines that wrap without the > added to the front of them. It
> therefore maybe best to strip off all of the carriage returns or manual
line
> breaks at the end of the line so that you are dealing with "word-wrapped"
> text.
>
> Sub PreFixLines()
> Dim oRng As Range
> Set oRng = Selection.Range
> Selection.Collapse
> While Selection.Range.End < oRng.End
> Selection.HomeKey Unit:=wdLine
> Selection.EndKey Unit:=wdLine, Extend:=wdExtend
> If Asc(Selection.Text) <> 13 Then
> Selection.HomeKey Unit:=wdLine
> Selection.TypeText "> "
> ' Must add a line break so the prefix will not
> ' be moved to the end of the previous line
> 'Selection.EndKey Unit:=wdLine
> 'Selection.TypeText Chr(11)
> Selection.MoveDown
> Selection.HomeKey Unit:=wdLine
> Else
> ' Empty line with just a paragraph mark
> Selection.HomeKey Unit:=wdLine
> Selection.TypeText "> "
> Selection.MoveDown
> End If
> Wend
> End Sub
>
>
> --
> Please post any further questions or followup to the newsgroups for the
> benefit of others who may be interested. Unsolicited questions forwarded
> directly to me will only be answered on a paid consulting basis.
> Hope this helps
> Doug Robbins - Word MVP
> "Cumulous" <Cumulous128@yahoo.com> wrote in message
> news:O541LLB1DHA.1336@TK2MSFTNGP12.phx.gbl...
> >
> >
> > Here is what your code is doing:
> >
> > 1. I start off by selecting a section of text. Then I run the macro.
> >
> > 2. The cursor goes to the beginning of the first line and adds "> ".
> >
> > 3. The cursor then goes to the end of the line.
> >
> > 4. An empty line is added.
> >
> > 5. The empty line is selected.
> >
> > 6. The cursor goes to the beginning of the EMPTY line that was just
added
> > and adds "> ".
> >
> > 7. Steps 4-6 repeat endlessly.
> >
> >
> >
> >
> > Cumulous
> >
> >
> >
> >
> > "Lars-Eric Gisslén" <nowhere@inter.net> wrote in message
> > news:uJss1X$0DHA.2972@TK2MSFTNGP09.phx.gbl...
> >> Cumulous,
> >>
> >> Works for me on both Word 2000 and 2003. Have you tried to set a break
> > point
> >> in the code and step through it and verify where the problem is?
> >>
> >> --
> >> Regards,
> >> Lars-Eric Gisslén
> >>
> >> "Cumulous" <Cumulous128@yahoo.com> skrev i meddelandet
> >> news:%231sdCH90DHA.2116@TK2MSFTNGP10.phx.gbl...
> >> >
> >> >
> >> > W