Forum Discussion
VBA - Range to include numbered lists
- Tom_GriffithMay 17, 2023Copper Contributoroh, wow. Is there a reverse of ConvertNumberstoText, in order to restore? I'd rather not change the list numbering on the Word doc itself, just need the text for the db with the converted to text list numbers. I've always struggled with this DOM as I'm thinking I'm changing some object in memory and not real-time ranges, etc on the Word doc. thank you so much again.
- May 17, 2023
Tom_Griffith Either use Undo, or close the document without saving it.
- Tom_GriffithMay 18, 2023Copper Contributor
Thanks again for your help on those two methods. I decided on the following (pseudo code.)
wordDoc.ConvertNumbersToText
var action_text=actionRange.FormattedText;
wordDoc.Undo
action_text=action_text.raplace(/\t\/," ")
...do insert stuff with action_text....
I was hoping to do a more precise Find.Execute on the Range to get rid of only the tabs inserted (number+tab+text) by ConvertNumberToText but I guess I'll live with a global tab replace on the text object (action_text) created from the Range. It'll dump any other tabs user may have put in but i think that'll be ok. I think doing any additional stuff after ConvertNumbersToText, like the Find.Replace, will shove the ConvertNumbersToText out as the Undo target. Thanks so much again.