Automatically Removing Certain Entries

R

Ralph

There are these certain entries, date/time stamp entries to be axact, on some
documents that I use that I would LOVE to be able to automatically remove
them all with some cool macro or something but I'm not too good with these
things. Here is a sample of the text:

"[4/9/2005 2:30:33 PM] <ht> On 3/29 MG775 fell below sma200.. and stayed
there for the last week.. waiting for another shoe to drop.
[4/9/2005 2:31:55 PM] <ht> Thursday AH USFC lowered Guidance .. a lot. They
cited 3 reasons for the shortfall.
[4/9/2005 2:32:17 PM] <ht> Top was slower Auto Sector business."

What I would love to be able to remove automatically from these entries are
these parts "[4/9/2005 2:30:33 PM] <ht>", "[4/9/2005 2:31:55 PM] <ht>",
"[4/9/2005 2:32:17 PM] <ht>"

A solution to this problem would be very gratefully appreciated, would make
my life all the easier.
 
A

Anand.V.V.N

Hi Ralph,

Dim cleanupstr As String
Dim tmptext As String
Dim anothertext As String


With ActiveDocument.Content

' for each sentence in the document

For i = 1 To .Sentences.Count


cleanupstr = .Sentences.Item(i)

If Mid$(cleanupstr, 1, 1) = "[" Then

' Here the sentence is being cleaned up in

temptxt = Mid(cleanupstr, InStr(1, cleanupstr, ">", vbTextCompare))
anothertext = Mid(temptxt, 2, Len(temptxt))
MsgBox anothertext



Else
End If
Next i
End With

Hope the above code helps you. You have done any VBA? Paste the code in a
button click and I have used msgbox to show the cleaned up string, you can
put it in a text box or any where you want.

Hope this code helped you.

Anand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top