View Full Version : Search for TAB and PARAGRAPH BREAK


RFC
07-23-2001, 08:31 AM
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).]

KDg
07-23-2001, 10:32 AM
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;


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

RFC
07-24-2001, 01:16 PM
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 ).