Forum Discussion

Tom_Griffith's avatar
Tom_Griffith
Copper Contributor
May 16, 2023

VBA - Range to include numbered lists

Hello. If you have a minute, I'm extracting text from a range within MS Word...for example...

 

targetRange.Start=200

targetRange.End=500

 

This returns all the text (targetRange.Text) but since unformatted (although line returns seem to be preserved), all numbered list labels (1,2,3...a, b, c sublists, etc) within the Range are stripped. Is there a way to preserve all the list designations within the text when setting a Range object? Tried targetRange.FormattedText but that doesn't seem to make a difference. thank you.

13 Replies

  • Tom_Griffith 

     

    You can retrieve the formatted text from a range. However, as Doug wrote, making a suggestion would be a lot easier if we knew exactly what you are trying to accomplish with your macro. 

    • Tom_Griffith's avatar
      Tom_Griffith
      Copper Contributor
      Hi. yeah, it gets the format but the numbered lists don't seem to be captured. I'm trying to take the range wording and put it into a text field in a db. Thank you.
    • Tom_Griffith's avatar
      Tom_Griffith
      Copper Contributor
      Hi. I'm trying to extract the wording from the range in MS Wprd and put it into a text field in a db. However, the numbered list labels aren't caught with Text and FormattedText. thank you so much

Resources