Greetings folks,
I need to load a word document file into a RichTextBox component, It can't be done directly, so, I need first, convert it to a RichText Format File and then load it to the component. Any Ideas?
Thanks
Omar
Greetings folks,
I need to load a word document file into a RichTextBox component, It can't be done directly, so, I need first, convert it to a RichText Format File and then load it to the component. Any Ideas?
Thanks
Omar
Hi,
Try this, I haven't been able to test it:
Dim Oword As Object
Dim Odoc As Object
Private Sub Command1_Click()
Set Oword = CreateObject("Word.Application")
Set Odoc = Oword.documents.open("C:\temp.doc")
Odoc.SaveAs FileName:="c:\x.rtf", FileFormat:=wdFormatRTF
Oword.quit
Me.RichTextBox1.FileName = "C:\x.rtf"
End Sub
Thanks KB ,
But, now I can't make it work, the "wdFormatRTF" is a non recognized variable :S, I tried to look for other options, but I can't find any related (and relevant) info about those options on the "Word.Application" object, maybe you can show me how can I accomplish this. Thanks
Hi,
Just replace the wdFormatRTF with number 6 (this code is for VB6, if you are using different IDE please advise).
Dim Oword As Object
Dim Odoc As Object
Private Sub Command1_Click()
Set Oword = CreateObject("Word.Application")
Set Odoc = Oword.documents.open("C:\temp.doc")
Odoc.SaveAs FileName:="c:\x.rtf", FileFormat:=6
Oword.quit
Me.RichTextBox1 = ""
Me.RichTextBox1.FileName = "C:\x.rtf"
End Sub
Thanks man!!,
That worked great!!, now I'm trying with other formats, I'll post how i'm doing with it...
ok i found this thread through google and im quite a novice at scripting but where exactly would i incert that bit of code you posted in my MS word documents code?
First, it's strongly frowned upon to post to threads that are more than three months old. Even if you have a question regarding an old thread, then you would start a new thread, and post a link to the old thread with your question. This will help to ensure that you get a warm and helpful welcome instead of the inevitable flaming that is sure to follow posting to old threads.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.