|
-
Nov 9th, 2004, 09:51 AM
#1
Thread Starter
Lively Member
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.
-
Nov 9th, 2004, 10:06 AM
#2
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.
-
Nov 9th, 2004, 10:08 AM
#3
Thread Starter
Lively Member
urgent help in WORD 10.0 object
yes i did, even then it is not working.
-
Nov 9th, 2004, 10:37 AM
#4
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.
-
Nov 9th, 2004, 10:44 AM
#5
Thread Starter
Lively Member
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?
-
Nov 9th, 2004, 10:47 AM
#6
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.
-
Nov 9th, 2004, 10:56 AM
#7
Thread Starter
Lively Member
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??
-
Nov 9th, 2004, 01:01 PM
#8
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|