View Single Post
 
Old 05-05-2021, 09:32 PM
NameIsJustAnIllusion NameIsJustAnIllusion is offline Windows 10 Office 2019
Novice
 
Join Date: May 2021
Posts: 11
NameIsJustAnIllusion is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Simple - have your macro:
1. Mark all content as hidden.
2. Find the text you want to preserve and unhide it
3. Find and delete all hidden text.
Thanks Paul for your reply. I am not sure I understand. What I want is not to hide but discard the text completely. Finally I would be saving the document.

Quote:
Find the text you want to preserve
There is no fixed text as I mentioned in the question. It is more about start position or end position. I have these as numbers and not text. The text/character at the start position can be a "Space" or a "Full Stop".

For example, let's say I have this simple text

Quote:
The quick brown fox jumps over the lazy dog
And I want to keep only the text from 11th position till 31st position with the formatting and delete everything. If it was an unformatted string, I could have used

Code:
MyString = "The quick brown fox jumps over the lazy dog"
Debug.Print Mid(MyString, 11, 31 - 11)
This would give me the desired text "brown fox jumps over" but the formatting is lost.
Reply With Quote