Results 1 to 8 of 8

Thread: urgent help in WORD 10.0 object

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    Brussels
    Posts
    104

    urgent help in WORD 10.0 object

    Hi,

    I have a peculiar problem. I am using Word 10.0 object, to do some functionality of converting txt files to doc files and some doc files to txt files. All my code is working perfectly, if i run it once, but if i run it second time i am getting an error saying

    "Run time error '462' :

    The remote server machine does not exist or unavailable"

    if i close the application, and if i complie and run it again, it works perfectly for the same input. please help me.

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    After you use the .Save method to save the work you're doing in Word, you should use the .Quit method, then set your Word object variable to Nothing. Reset your Word object to a new instance to do another unit of work (and be sure to clean up at the end as described).
    "It's cold gin time again ..."

    Check out my website here.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    Brussels
    Posts
    104

    urgent help in WORD 10.0 object

    yes i did, even then it is not working.

  4. #4
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    The only other thing I can suggest at this point is make sure there are no other instances of WINWORD running when you run your program (check the Task Manager).
    "It's cold gin time again ..."

    Check out my website here.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    Brussels
    Posts
    104
    yes, when i delete all the instances of WINWORD the code is working perfectly. But i can not ask the user to do that, right?

  6. #6
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    I think it's reasonable to let the user know that as a condition of using your application, all other instances of Word must be closed. If that is not acceptable, then further experimentation and testing must be done to get your app working even if another instance is open.
    "It's cold gin time again ..."

    Check out my website here.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    Brussels
    Posts
    104

    Resolved urgent help in WORD 10.0 object --resolved

    Thanks very much Bruce. I think i solved the problem. used app.Quit and app = nothing on Form_Unload() function. it is working. Of course, it is by fluke, i did this. i don't know why it was not working and when i did as the way below.

    Code:
    Dim wordapp as Word.Application
    ....
    ....
    ....
    
    Private Sub cmd_Click()
    
    Set wordapp = New Wrod.Application
    
    ....functions calls that uses wordapp object
    ....
    ....
    
    If IsObjectValid(wordapp) Then
    
    wordapp.Quit
    set wordapp = Nothing
    
    End If
    End Sub
    Do you have any idea why the above code does not work??

  8. #8
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    I'm glad you got it working. I don't see anything wrong with the basic code you are showing there. I don't know what the "IsObjectValid" function is doing, but it should be the equivalent of "If Not wordapp Is Nothing Then ...".
    "It's cold gin time again ..."

    Check out my website here.

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