InOverMyHead
07-10-2005, 12:00 AM
Thanks loads!! BTW - Its not my choice to use tabs - I'm trying to get rid
of them, actually. They often arise in tab delimited files as you no doubt
know. AND I'm not looking to delete text between tabs - that was just an
example. I want to be able to delete text between "Here" (current curser
location) (and probably result of a Find action) and "There" (text string
xxx for example) (and result of another Find action). I was trying macros
(this operation must repeat hundreds of times in a long document) but it
doesn't seem to be able to "Select" and delete like I would expect. Now
comes Klaus with a most reasonable idea - use find and replace! Duh - I
don't know why I didn't think of this! I tried the example and it didn't
work immediately, but it sure gave me some ideas - so I now just do Find -
^t*^t and replace with [blank]. Seems to work, but am I missing something
by not using all those swear words ((^t)[!^13]@(^t)\1\2)??
Thanks again! (Wowser - there's a lot more power in the search&replace than
I had noticed!!)
Bob
"Klaus Linke" <info@fotosatz-kaufmann.de> wrote in message
news:OwcKAbZVFHA.3808@TK2MSFTNGP14.phx.gbl...
Hi Bob,
Hmm... Professional Word users will tell you to avoid tabs altogether.
Then why should Word offer a special built-in function to delete stuff
between two tabs?
BTW, you can delete the stuff between the next two tabs with Find/Replace,
similar to the macro Greg posted:
Edit > Replace, check "Match wildcards",
Find what: (^t)[!^13]@(^t)
Replace with: \1\2
You can use the macro recorder to create a macro from this without writing a
line of code.
If you have a "table" done with tabs, you can also use
Alt+LeftMouseButton+Drag to select a "column" and delete it.
Greetings,
Klaus
"InOverMyHead" <bbart@nospam.ix.netcom.com> schrieb im Newsbeitrag
news:OvBkluYVFHA.1384@TK2MSFTNGP09.phx.gbl...
>
> "Greg" <gmaxey@mvps.org> wrote in message
> news:1115727284.208348.170650@f14g2000cwb.googlegroups.com...
> > Bob,
> >
> > You don't really need to select the text to delete it. Here is a macro
> > that finds text between the first and second tabs following the
> > insertion point and deletes the text while leaving the tabs.
> >
> > Sub DeleteTextBetweenTabs()
> > Dim myRange As Range
> > Set myRange = Selection.Range
> > myRange.End = ActiveDocument.Range.End
> > With myRange.Find
> > .ClearFormatting
> > .MatchWildcards = True
> > .Text = "^t" & "*" & "^t"
> > .Execute
> > myRange.Start = myRange.Start + 1
> > myRange.End = myRange.End - 1
> > myRange.Delete
> > End With
> > End Sub
>
> Thanks for the responses! But it sure sounds more complicated than it otta
> be!!?!! . (And to think that in WordPerfect all I had to do was hit one
key
> for "Select"!!) Let's assume for the moment - just for the sake of this
> discussion - that I don't do programming, that I am a newbie (note
newsgroup
> name) and I expect the Macro function to simply record keystrokes - then
> play them back on command. From the responses, may I conclude I'm outa
luck
> on the delete-between-tabs routine, and that this is beyond the ability of
> Bill's programmers to build into this product?
>
> (In fact, I would use variations of the delete-between-tabs routine often,
> but each time it would use different from-to points. And I sure don't
want
> to have to write a program for every macro I use.)
>
> Bob
>
of them, actually. They often arise in tab delimited files as you no doubt
know. AND I'm not looking to delete text between tabs - that was just an
example. I want to be able to delete text between "Here" (current curser
location) (and probably result of a Find action) and "There" (text string
xxx for example) (and result of another Find action). I was trying macros
(this operation must repeat hundreds of times in a long document) but it
doesn't seem to be able to "Select" and delete like I would expect. Now
comes Klaus with a most reasonable idea - use find and replace! Duh - I
don't know why I didn't think of this! I tried the example and it didn't
work immediately, but it sure gave me some ideas - so I now just do Find -
^t*^t and replace with [blank]. Seems to work, but am I missing something
by not using all those swear words ((^t)[!^13]@(^t)\1\2)??
Thanks again! (Wowser - there's a lot more power in the search&replace than
I had noticed!!)
Bob
"Klaus Linke" <info@fotosatz-kaufmann.de> wrote in message
news:OwcKAbZVFHA.3808@TK2MSFTNGP14.phx.gbl...
Hi Bob,
Hmm... Professional Word users will tell you to avoid tabs altogether.
Then why should Word offer a special built-in function to delete stuff
between two tabs?
BTW, you can delete the stuff between the next two tabs with Find/Replace,
similar to the macro Greg posted:
Edit > Replace, check "Match wildcards",
Find what: (^t)[!^13]@(^t)
Replace with: \1\2
You can use the macro recorder to create a macro from this without writing a
line of code.
If you have a "table" done with tabs, you can also use
Alt+LeftMouseButton+Drag to select a "column" and delete it.
Greetings,
Klaus
"InOverMyHead" <bbart@nospam.ix.netcom.com> schrieb im Newsbeitrag
news:OvBkluYVFHA.1384@TK2MSFTNGP09.phx.gbl...
>
> "Greg" <gmaxey@mvps.org> wrote in message
> news:1115727284.208348.170650@f14g2000cwb.googlegroups.com...
> > Bob,
> >
> > You don't really need to select the text to delete it. Here is a macro
> > that finds text between the first and second tabs following the
> > insertion point and deletes the text while leaving the tabs.
> >
> > Sub DeleteTextBetweenTabs()
> > Dim myRange As Range
> > Set myRange = Selection.Range
> > myRange.End = ActiveDocument.Range.End
> > With myRange.Find
> > .ClearFormatting
> > .MatchWildcards = True
> > .Text = "^t" & "*" & "^t"
> > .Execute
> > myRange.Start = myRange.Start + 1
> > myRange.End = myRange.End - 1
> > myRange.Delete
> > End With
> > End Sub
>
> Thanks for the responses! But it sure sounds more complicated than it otta
> be!!?!! . (And to think that in WordPerfect all I had to do was hit one
key
> for "Select"!!) Let's assume for the moment - just for the sake of this
> discussion - that I don't do programming, that I am a newbie (note
newsgroup
> name) and I expect the Macro function to simply record keystrokes - then
> play them back on command. From the responses, may I conclude I'm outa
luck
> on the delete-between-tabs routine, and that this is beyond the ability of
> Bill's programmers to build into this product?
>
> (In fact, I would use variations of the delete-between-tabs routine often,
> but each time it would use different from-to points. And I sure don't
want
> to have to write a program for every macro I use.)
>
> Bob
>