Click to See Complete Forum and Search --> : interaction with word thru vb -- urgent


abbu
March 2nd, 2001, 07:53 AM
Hi,
I am basically java developer and today need a little vb program to do word documents conversion to html...when i try to create word object in vb with Word.Application.Documents.Open(...)..the compile is ok but getting run time error saying that the "activex cannot create the object"..

Please someone help...as its urgent...

sotoasty
March 2nd, 2001, 08:09 AM
I am not sure about the rest of your code, but that looks very familiar to several errors I have recieved in the past. If you code goes like I think it does, what is happening is that the Word application is not finished opening before you try to open the document with your word.application.documenst.open statement. One way to avoid this is to put the open in a loop like...


on error resume next
do
err=0
word.application.documents.open()
doevents
loop until err=0





If you get an error in the code then the document was not opened and your loop continues until the word application becomes available and is able to open the document.

Hope this helps

CK Dixon
March 2nd, 2001, 08:13 AM
Use a Documents.Add before Open. I don't know why this is needed, but it works.

abbu
March 2nd, 2001, 08:55 AM
Thanks guys..
I am able to overcome this by

Dim objWord As Word.Application

then
Dim objDoc as Word.Document

objWord = CreateObject("Word.Application")
objDoc = objWord.Documents.Open("filename")

But now i am having different problems...

I have posted them here...
Thanks anyway

Cimperiali
March 2nd, 2001, 10:15 AM
"activex cannot create the object"... you referenced the Word runtime libraries
but maybe you're running your application on a machine without word on it, or you have some matter with DCOM or DCOM+ (no WindowsNt? haihaihaihai...). I am afraid I cannot help more, but VB is a lot worse than Java about COM components.
You should post here your question again, trying to explain better your matter. Sooner or later, a truly Guru will answer

Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.