VBA and Word - save Paragraph as RTF tags

S

sippyuconn

Hi

I am looping thru paragraphs and extracting the ones I want as Text but I
would
like to save the text with rtf tags to a text file is that possible ???
Each paragraph will be a unique key followed by the rtf of the paragraph so
I can later put into a RTFControl

Thanks

For Each para In doc.Paragraphs
'Put the code here to manipulate the paragraph

If (para.Range.Font.Size = 9 And _
para.Range.Font.Name = "Times New Roman") Then
sLine = para.Range.Text
Print #pFileNum, "This is new Text add key for each paragraph"
Print #pFileNum, sLine 'Save paragraph as rtf tags
End IF
Next
 
W

Wei Lu [MSFT]

Hello sippyuconn,

I would like to know whether you want to save the Text into RTF format.

If so, how about save the document as RTF format and then try to loop the
paragraphs?

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

sippyuconn

Hi

I want to save as a text file but the paragraph I want to save the rtf tags

I will create a file with a key for every paragraph followed by a string that
would be the paragraph plus the rtf formatting of that paragraph.

I will later just this file to lookup the paragraphs and copy the text to a
rtfcontrol
to show the text with the saved formatting
 
W

Wei Lu [MSFT]

Hello sippyuconn,

Unfortunately, VBA did not provide such function to parse a part of text in
Word to the RTF format.

You may need to use some third party tools to parse it or you may need to
follow the RTF format to parse by your self.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Wei Lu [MSFT]

Hi ,

How is everything going? Please feel free to let me know if you need any
assistance.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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