Re: macro to select text from one point to another
- From: eugene <eugene@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 13 Feb 2007 09:35:01 -0800
Greg,
Thanks loads.
It does what exactly what I need. (Now to figure out exactly what it is
doing, so I can modify it if necessary.)
One thing I am doing away with for sure, and would not generally recommend,
is "Documents.Add." It creates a new document for each piece of text that is
copied which is not what i want. Instead, I will write to a single file.
--
eugene
"Greg Maxey" wrote:
On Feb 13, 11:39 am, eugene <eug...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:.
Hi,
I would like to mark up a text and have a macro select the pieces of text
from one mark to another (eg all text between * to %), copy it and then
paste it into a new file.
Any suggestions on how this can be done neatly?
(I can do the copy/paste part of it. But I don't know how to instruct
selection between the marks. I would suppose one could use find. But know how
to select when finding.)
--
eugene
Maybe something like this:
Sub ScratchMacro()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "[\*]*%"
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
While .Execute
'Clip special characters from found text
oRng.Start = oRng.Start + 1
oRng.End = oRng.End - 1
ScratchMacro2 oRng
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub
Sub ScratchMacro2(ByVal oRng2 As Range)
Documents.Add
Selection.Range.Text = oRng2.Text
End Sub
- Follow-Ups:
- Re: macro to select text from one point to another
- From: Greg Maxey
- Re: macro to select text from one point to another
- References:
- Re: macro to select text from one point to another
- From: Greg Maxey
- Re: macro to select text from one point to another
- Prev by Date: Re: Table Formatting in Protected Document
- Next by Date: Re: MailMerge API Trouble
- Previous by thread: Re: macro to select text from one point to another
- Next by thread: Re: macro to select text from one point to another
- Index(es):
Relevant Pages
|