Search for TAB and PARAGRAPH BREAK

  • Thread starter Thread starter RFC
  • Start date Start date
R

RFC

Guest
I'm having to format a data file so that it can be imported into Access. I'm trying to create a macro that will help me format this file without having to spend all day modifying each line of data by hand. I am trying to create a macro in MS Word 2000.

Can anyone show me a piece of code that will search for a paragraph break and a tab, in that order?

The way this data file is formated is that is shows the following:
12345
       This is the Notes......

Please let me know if I need to clarify.

Thanks to anyone who can help me!

[This message has been edited by RFC (edited 07-23-2001).]

[This message has been edited by RFC (edited 07-23-2001).]

[This message has been edited by RFC (edited 07-23-2001).]
 
Hi RFC,

this isn't a complete solution as i've never used VBA in word and don't have 2k, but if you tweak the below a bit you should be able to get what you want;

Code:
Dim x As Integer
        For x = 1 To Len(ActiveDocument.Content)
            x = InStr(x, ActiveDocument.Content, Chr(13))
            If x Then
                If StrComp(Chr(9), Mid(ActiveDocument.Content, x + 1, 1)) = 0 Then
                    'go do some stuff
                End If
            Else
                Exit For
            End If
        Next x

I suspect there is a much better way of doing this so you may be better off waiting for an answer from someone that's actually done this before, anyhow best of luck with it

regards

Drew
 
Thanks for your help. I ended up having to modify the Len(ActiveDocument.Content) part of the code. I kept getting some type of memory overrun erros (Not sure, can't remember what it was ).
 

Users who are viewing this thread

Back
Top Bottom