Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting a string with carrage returns

Status
Not open for further replies.

taylo40

IS-IT--Management
Aug 27, 2003
52
GB

Hi,
Could anybody help me please ?

I have a very large text file which contains the audit log.
I have imported this into word and would like to count the number of occurrances of a string.

The problem I have is that the string contains 2 carrage returns.

ActionCode="C"
Company="20"
SchedPaymentAmount

Word cannot find a string where there is a carrage return.

Any ideas ?
 
Hi taylo40,

To include a carriage return in a find string ..

In the Find dialog click the [blue]More...[/blue] button if there is one.
Click the [blue]Special...[/blue] button.
Select [blue]Paragraph mark[/blue]

Or, to enter it directly in the find box just type [blue]^p[/blue].

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Yes it can. A carriage return is ASCII character code 13. So in your search you can use Chr(13). This is a carriage return.

ActionCode="C" & Chr(13) & Company="20" & (chr(13) & SchedPaymentAmount

You will have to do dealt with the literal quotation marks around the "C". Note that if you use the Find function the code looks like:

Code:
With Selection.Find
    .Text = """C"""
End With
Selection.Find.Execute
It needs the extra "".

The ASCII character code for " is 34, so

"ActionCode=" & Chr(34) & "C" & Chr(34) & Chr(13) & "Company=" & Chr(34) & "20" & Chr(34) & (Chr(13) & SchedPaymentAmount

will get concatentate your text into the proper string.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top