CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2001
    Posts
    9

    interaction with word thru vb -- urgent

    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...


  2. #2
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: interaction with word thru vb -- urgent

    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


  3. #3
    Join Date
    Jun 2000
    Location
    Nepal
    Posts
    108

    Re: interaction with word thru vb -- urgent

    Use a Documents.Add before Open. I don't know why this is needed, but it works.


  4. #4
    Join Date
    Mar 2001
    Posts
    9

    Re: interaction with word thru vb -- urgent

    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


  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: interaction with word thru vb -- urgent

    "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.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured