
Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
I am trying to replace the spaces with the same number of tabs. I tried
taking the code from Dreamweaver, putting it into WORD and writing a
macro but I had trouble.
I had trouble having the macro ignore ALL spaces within < > and only
replacing spaces immediately after a linebreak ^13 and before a < with
the same number of tabs.
> It's not really clear from your discription and example whether you want to
> replace leading spaces with the same number of tab spaces or remove them,
[quoted text clipped - 27 lines]
> >
> > Any ideas?
Russ - 10 May 2006 17:59 GMT
You can use find and replace to apply highlight or some other formatting to
'distinguish' parts of the document you want to ignore, like the "<*>" and
then attack the rest of the undistinguished parts of the document by telling
find and replace to only find, for instance, unhighlighted text patterns.
When you are done attacking, remove your highlighting or whatever special
formatting you used.
You don't have to try to cram it into just one find and replace pattern.
> I am trying to replace the spaces with the same number of tabs. I tried
> taking the code from Dreamweaver, putting it into WORD and writing a
[quoted text clipped - 35 lines]
>>>
>>> Any ideas?

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID <-- fix this before replying
Russ - 10 May 2006 18:48 GMT
> You can use find and replace to apply highlight or some other formatting to
> 'distinguish' parts of the document you want to ignore, like the "<*>" and
I should have used "\<*\>" as an example to escape the < >
characters and make them literal characters and not wildcards for
searching.
> then attack the rest of the undistinguished parts of the document by telling
> find and replace to only find, for instance, unhighlighted text patterns.
[quoted text clipped - 42 lines]
>>>>
>>>> Any ideas?

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID <-- fix this before replying
Doug Robbins - Word MVP - 10 May 2006 21:29 GMT
The following should do it:
Dim i As Long, j As Long, k As Long, tabstring As String
Dim apara As Paragraph
With ActiveDocument
For k = 1 To .Paragraphs.Count
tabstring = ""
i = InStr(.Paragraphs(k), "<")
If i > 1 Then
For j = 2 To i
tabstring = tabstring & vbTab
Next j
.Paragraphs(k).Range = tabstring & LTrim(.Paragraphs(k).Range)
End If
Next k
End With

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
>I am trying to replace the spaces with the same number of tabs. I tried
> taking the code from Dreamweaver, putting it into WORD and writing a
[quoted text clipped - 37 lines]
>> >
>> > Any ideas?