Removing text outside the <<...>> brackets

danish6061

New Member
Joined
Mar 16, 2020
Messages
44
Office Version
  1. 2016
Platform
  1. Windows
Hi, I have a question,
I have a word document which is in arabic, the file has a lot of text that I have placed between the following brackets: «............» Is there any way i can delete ALL the text in the document and just preserve whats between these two brackets?
Please help me... Thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hello danish69061. As nobody has responded I thought I would give you some code that might help you get started. This is done for excel using a phrase in cell A1 and puts the contents inside the brackets in Cell A2. Hope this helps you get started. Try this on a sample spreadsheet first.

VBA Code:
Sub CopyInside()
Dim Start1 As Integer
Dim Stop1 As Integer
Start1 = InStr(1, Cells(1, 1).Value, "<<", vbBinaryCompare)
Stop1 = InStr(1, Cells(1, 1).Value, ">>", vbBinaryCompare)
copylength = Stop1 - Start1

Dim strLen As Integer
strLen = Len(Cells(1, 1).Value)
String1 = Left(Right(Cells(1, 1).Value, strLen - Start1 - 2), copylength - 3)

Cells(2, 1).Value = String1

End Sub
 
Upvote 0
Thankss Goesr for reply... But really it does'nt work. Could you suggest me something better!
 
Upvote 0
I thought I would give you some code that might help you get started. This is done for excel using a phrase in cell A1 and puts the contents inside the brackets in Cell A2.
That's all very well but, as the OP said clearly enough:
I have a word document which is in arabic, the file has a lot of text that I have placed between the following brackets: «............»
@ danish6061 - you could insert:
»
at the start of the document, and:
«
at the end of the document, then use a wildcard Find/Replace, where:
Find = »*«
Replace = ^p
 
Upvote 0
Macropod - Great idea. I think you can help danish6061 in the future. I'm sorry my solution was not up to your standards. As nobody else had responded, I hoped this could get him started. I would like to see your code to solve the problem so that both danish6061 and I could see how it is done.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top