#1   Report Post  
Posted to microsoft.public.word.formatting.longdocs
Robert Mileski Robert Mileski is offline
external usenet poster
 
Posts: 3
Default Hot to parse RTF String

Hi,

I have a question.

I want to put a string through VBA in Word, which has a "RTF Syntax" in a
Word document, but parsed, that is formatted.

I'll give you an example:

Sub ParseRTF()
Dim txtStr as String

txtStr = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\f charset0
MS Sans Serif;}}\viewkind4\uc1\pard\lang1031\b\f0\fs17 This is an example of
a String in RTF Format\par }"

End Sub


So, now I have a String with RTF. The problem is now, how can I put this
text in a Word Document, but it should be pasted already formated, not just
as a plain text.

One way of doing this, is putting the String in a .rtf File, and then using
this command: Selection.InsertFile FileName:="C:\TEST.rtf", Link:=True


But I don't want to use a file, because of the time doing a disk read. I
want to paste the formatted string in the document directly.


I want to do this, because I have an MS Access Database, where I store the
RTF Strings in Memo Fields. I want to read them from the database, and
formatted, put them in a document.


Every help will be much appreciated.


Best Regards,
Robert Mileski


  #2   Report Post  
Posted to microsoft.public.word.formatting.longdocs
Jezebel Jezebel is offline
external usenet poster
 
Posts: 1,384
Default Hot to parse RTF String

Is there anywhere you *didn't* post this question?



"Robert Mileski" wrote in message
...
Hi,

I have a question.

I want to put a string through VBA in Word, which has a "RTF Syntax" in a
Word document, but parsed, that is formatted.

I'll give you an example:

Sub ParseRTF()
Dim txtStr as String

txtStr = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\f charset0
MS Sans Serif;}}\viewkind4\uc1\pard\lang1031\b\f0\fs17 This is an example
of a String in RTF Format\par }"

End Sub


So, now I have a String with RTF. The problem is now, how can I put this
text in a Word Document, but it should be pasted already formated, not
just as a plain text.

One way of doing this, is putting the String in a .rtf File, and then
using this command: Selection.InsertFile FileName:="C:\TEST.rtf",
Link:=True


But I don't want to use a file, because of the time doing a disk read. I
want to paste the formatted string in the document directly.


I want to do this, because I have an MS Access Database, where I store the
RTF Strings in Memo Fields. I want to read them from the database, and
formatted, put them in a document.


Every help will be much appreciated.


Best Regards,
Robert Mileski



  #3   Report Post  
Posted to microsoft.public.word.formatting.longdocs
Robert Mileski Robert Mileski is offline
external usenet poster
 
Posts: 3
Default Hot to parse RTF String

Yes, I did post it in many groups. And thanks to that, I got many different
ways to solve the problem, which I did.

Anyway, I don't see any of yours answers contributing to this discussion?!





Best regards,

Robert Mileski



"Jezebel" wrote in message
...
Is there anywhere you *didn't* post this question?



"Robert Mileski" wrote in message
...
Hi,

I have a question.

I want to put a string through VBA in Word, which has a "RTF Syntax" in a
Word document, but parsed, that is formatted.

I'll give you an example:

Sub ParseRTF()
Dim txtStr as String

txtStr =
"{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\f charset0 MS Sans
Serif;}}\viewkind4\uc1\pard\lang1031\b\f0\fs17 This is an example of a
String in RTF Format\par }"

End Sub


So, now I have a String with RTF. The problem is now, how can I put this
text in a Word Document, but it should be pasted already formated, not
just as a plain text.

One way of doing this, is putting the String in a .rtf File, and then
using this command: Selection.InsertFile FileName:="C:\TEST.rtf",
Link:=True


But I don't want to use a file, because of the time doing a disk read. I
want to paste the formatted string in the document directly.


I want to do this, because I have an MS Access Database, where I store
the RTF Strings in Memo Fields. I want to read them from the database,
and formatted, put them in a document.


Every help will be much appreciated.


Best Regards,
Robert Mileski





  #4   Report Post  
Posted to microsoft.public.word.formatting.longdocs
PeterMcC PeterMcC is offline
external usenet poster
 
Posts: 51
Default Hot to parse RTF String

Robert Mileski wrote in


Yes, I did post it in many groups. And thanks to that, I got many
different ways to solve the problem, which I did.

Anyway, I don't see any of yours answers contributing to this
discussion?!


You might want to have a look at this - the advice in it should help you get
better responses if you feel that your query is applicable to a range of
newsgroups.

Essentially, you multi-posted when cross-posting would have served your
purposes better.

http://www.cs.tut.fi/~jkorpela/usenet/xpost.html#how

--
PeterMcC
If you feel that any of the above is incorrect,
inappropriate or offensive in any way,
please ignore it and accept my apologies.

  #5   Report Post  
Posted to microsoft.public.word.formatting.longdocs
John McGhie [MVP - Word and Word Macintosh] John McGhie [MVP - Word and Word Macintosh] is offline
external usenet poster
 
Posts: 506
Default Hot to parse RTF String

Answered in another group


On 14/1/07 4:55 AM, in article ,
"Robert Mileski" wrote:

Hi,

I have a question.

I want to put a string through VBA in Word, which has a "RTF Syntax" in a
Word document, but parsed, that is formatted.

I'll give you an example:

Sub ParseRTF()
Dim txtStr as String

txtStr = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\f charset0
MS Sans Serif;}}\viewkind4\uc1\pard\lang1031\b\f0\fs17 This is an example of
a String in RTF Format\par }"

End Sub


So, now I have a String with RTF. The problem is now, how can I put this
text in a Word Document, but it should be pasted already formated, not just
as a plain text.

One way of doing this, is putting the String in a .rtf File, and then using
this command: Selection.InsertFile FileName:="C:\TEST.rtf", Link:=True


But I don't want to use a file, because of the time doing a disk read. I
want to paste the formatted string in the document directly.


I want to do this, because I have an MS Access Database, where I store the
RTF Strings in Memo Fields. I want to read them from the database, and
formatted, put them in a document.


Every help will be much appreciated.


Best Regards,
Robert Mileski



--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using IF to find whether a Merge Field contains a substring Joshua Pangborn Mailmerge 12 May 11th 23 02:51 AM
Hot to parse RTF String Robert Mileski Microsoft Word Help 2 January 14th 07 11:44 AM
How do I convert a number into a text string (5 into "Five")? Oleg Microsoft Word Help 3 July 19th 06 08:34 PM
Create Form For Access Database Gordon Padwick Microsoft Word Help 2 May 8th 06 09:58 AM
Could not parse query into a valid SQL string. Judy Mailmerge 0 September 8th 05 12:02 AM


All times are GMT +1. The time now is 08:27 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"