|
-
Aug 13th, 2002, 03:17 PM
#1
Thread Starter
New Member
OLE Word Objects
I am just stating with OLE, and I’m weak on objects. First a bit of background, then questions.
My first two OLE attempts have had some success.
My first attempt was to control MS Word 95 with my VB6 on WMe. It turns out that I can’t use MS Word 95 this way as it does not exist in the VB’s references, so using code like:
Public objApp as New Word.application
Public objDoc as Object
does not work -- the Word.appliation does not exist, so code like
objapp.visible=true
and
objdoc.content = "My first OLE"
does not work.
For attempt two, I duplicated a little program from "How to use the Spelling Corrector tool of MS Word within VB" on the VBWorld site http://216.26.168.92/tips/tip81.html (nice and simple). It works with older MS Words. The sequence of operations:
Create Word Object { Set Word = CreateObject("Word.Basic") }
Show Word
Word New file
Insert text into Word from VB text box
Start Word Spell checker
Word Edit Select All
Then grab the selection and put in into a VB text box.
Almost works. It works if I take out the call to the spell checker. The spell checker creates an error 51 which just says the spell checker is done. On Error Resume Next does not help -- although the code runs, nothing is output after starting the spell checker. I’m sure the whole problem is my trying to use the old Word95, but it is what I have.
QUESTIONS:
1) Is there a way I can deal with the error caused by the spell checker indicating it is done, so I can use the spell checker?
2) Whereas the {Public objApp as New Word.application} is exposed when I choose the appropriate newer MS Word reference in VB, where do I find out about the {CreateObject("Word.Basic")}? Where did the "Word.Basic" come from? Where do I find out about it and others like it?
3) What is the difference between the two word objects created in the two examples {Public .... word.application vs. Set .... CreateObject("Word.Basic") }?
I realize the answers to the everything afte the first question could be multiple tutorials, but I'm just looking for a hint here, so I can better focus my search. (A tutorial would be good too!)
Thanks.
-Mike-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|