|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
OLE Automation error 462
Hi All,
I have this error message coming once a while on the system and it's getting me go crazy at this point.. I've tried all possible combinaision possible, read every little post I could find on the web, scan and did all of microsoft knowledge base db and I still have it pointing is face once upon a time... Am really out of ressources, error message is The remote server machine does not exist or is unavailable This is a ASP application calling a visual basic dll ( made on our own ) that is simply grabbing some parameters and open a query, printing the data on a word document, basically, it's a search and replace on a word template that is replacing some predefined tags with the db values. This is working fine, so no dll registered on the server problem... no com+ application problems... Only this error coming once a while... I've attach on below post a little exe and related code that is replicating the exact error, of course this is not what I have in the dll.. just in case... but this is a good example of the problem. If there is anybody out there, with a solution for this question, then you will do my year. Trully... Ok Thanks a bunch Last edited by R2D2 : December 28th, 2003 at 02:27 AM. |
|
#2
|
|||
|
|||
|
When u get this wrong after u run your code??Plz give a part of the code where worng happened!...
|
|
#3
|
|||
|
|||
|
Did you register your vb dll on the web server successfully?
|
|
#4
|
||||
|
||||
|
strangely enough, I had this error on a machine at work. IIS couldn't find a dll I was using in a web app, and simply restarting IIS solved the problem. I agree with CP, though. We would need more information about what resource is not being found before we could help
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#5
|
|||
|
|||
|
Hi all,
Thanks for the reply's. I've tried to grab only the part where there is a problem cause cant really post all my code. But this is exactly reproducing the problem. If you paste everyting in a new exe project and add a command button you will see the error. First click on the button will create the word object without any problem, close it, etc, could even check the process running to be sure that winword.exe is not running anymore. Where it becomes strange, is if you click again on the command button then you will receive the 462 error. In another hand, if you run it, hit the button, everything is fine, stop the execution, run it again and hit the button, everything is fine again, it will always be working, as long as it's the first time running it will always work. But as soon as you will try to re-execute it a second time the 462 error will occur. So basically this is the problem am receiving when running my dll. And yes, I've did all of the above suggestions, ( register on server,etc...) it is actually working and running. But this error occurs at an intermittent time and in no special situation. Also, everything in the DCOM+ settings for my dll is ok. The exe attach is this exact code for the ones who want to try it right away. If not then dont forget to add a reference on your project to Word 9.0 object library. Thanks again Option Explicit Private mlngErrorLine As Long Private mlngErrorNumber As Long Private mstrErrorSource As String Private mstrErrorDescription As String Public Property Get ErrorLine() As Long ErrorLine = mlngErrorLine End Property Public Property Get ErrorNumber() As Long ErrorNumber = mlngErrorNumber End Property Public Property Get ErrorSource() As String ErrorSource = mstrErrorSource End Property Public Property Get ErrorDescription() As String ErrorDescription = mstrErrorDescription End Property Private Sub Command1_Click() Dim oWordApp As Word.Application Dim oTargetDoc As Word.Document On Error GoTo errHandler If TypeName(oWordApp) <> "Application" Then 1 Dim temp As Word.Application 2 Set temp = CreateObject("Word.Application") 3 Set oWordApp = CreateObject("Word.Application") 4 temp.Quit 5 Set temp = Nothing 6 oWordApp.Visible = False End If 7 MsgBox "Word application object is : " & IsObjectValid(oWordApp) 8 oWordApp.Documents.Add.SaveAs FileName:="c:\testing.doc" 9 Set oTargetDoc = oWordApp.Documents.Open("c:\testing.doc") 10 MsgBox "Word document object is : " & IsObjectValid(oTargetDoc) 11 oWordApp.Quit savechanges:=wdSaveChanges 12 Set oWordApp = Nothing Exit Sub errHandler: MsgBox "line = : " & Erl & vbCrLf & "Number = : " & Err.Number & vbCrLf & "desc = : " & Err.Description oWordApp.Quit Set oWordApp = Nothing On Error Resume Next End Sub Private Sub Command2_Click() End End Sub |
|
#6
|
|||
|
|||
|
By the way.. this part
If TypeName(oWordApp) <> "Application" Then 1 Dim temp As Word.Application 2 Set temp = CreateObject("Word.Application") 3 Set oWordApp = CreateObject("Word.Application") 4 temp.Quit 5 Set temp = Nothing 6 oWordApp.Visible = False End If is coming from a workaround stated by MS to avoid this error. They stated that this is a Ms Office bug... http://support.microsoft.com/defaul...&NoWebContent=1 |
|
#7
|
|||
|
|||
|
I have the same worng used your source code!!But i find your wrong happened in 7 line:MsgBox "Word application object is : " & IsObjectValid(oWordApp).So I comment the 2 line:
7 MsgBox "Word application object is : " & IsObjectValid(oWordApp) 10 MsgBox "Word document object is : " & IsObjectValid(oTargetDoc) The wrong doesn't happen After i modify it.. |
|
#8
|
|||
|
|||
|
yes... but the goal here was to show that on the second hit, the objects are not valid... in my dll there is no message box... if you want, you could replace it with any call to the word application object. As soon as you will refer either a method or property it will return you the same error. Those 2 lines you've commented there where only meant to show that the objects that are refering to word properties and methods are not valid.. so if they are not valid then we cannot perform any kind of task with those object... but as you have seen, they are valid on the first pass...
Like I said, once the object is created I perform various operation on the word document with different methods and propeties... am not displaying a message box.... Thanks |
|
#9
|
|||
|
|||
|
@Cleverpig, I presume you where joking me... at least I hope so... :-)
|
|
#10
|
||||
|
||||
|
well, I've tried running this code, and everything seems to be kosher. I can't seem to figure out why it would be performing this way. I've checked the status of the variables before and after assignment in every iteration (every time I press the button), and everything is ok until you get to the Isvalidobject(). I've even set the word app to visible in the immediate window, and the application is, in fact, valid. I will continue to look for problems and will let you know what I find.
|
|
#11
|
|||
|
|||
|
The same error in word application develop period:http://oldlook.experts-exchange.com...Q_20753661.html
Hope it give us some revelation. |
|
#12
|
|||
|
|||
|
@cleverpig, I had a look and cant see what is wrong on the code... Put the document.active after creating it? I'll be trying it. Nothing to loose at this point!
@Fisherman, thanks for your help, yes effectivly, it's a gotcha this one. I've seen alot during time but this one is going to be on my top 5 list when I'll have it clear! Thanks |
|
#13
|
||||
|
||||
|
as an even more interesting problem, I just tried this at work where we have the Word 10.0 library, and none of it works. It doesn't give the same error, but the word.application always returns false for isvalidobject.
|
|
#14
|
|||
|
|||
|
Guy's I've fix the problem,
here is the part where the problem was originating. 740 For i = 1 To 50 750 If TFDB(i) <> "" Then 760 Selection.HomeKey unit:=wdStory With Selection.Find 770 .ClearFormatting 780 .Text = TFDB(i) 790 .Replacement.Text = "" 800 .Forward = True 810 .Wrap = wdFindStop 820 .Format = False 830 .MatchCase = True 840 .MatchWholeWord = False 850 .MatchWildcards = False 860 .MatchSoundsLike = False 870 .MatchAllWordForms = False 880 Do While .Execute() 890 Selection.InsertFile _ FileName:=SUBSTITUTION_FOLDER & TFDB(i), Range:="", _ ConfirmConversions:=False, _ Link:=False, _ Attachment:=False 900 Loop End With End If 910 Next Briefly what I do is looping in an array that could contain up to 50 document name, grabbing the name if there is one and searching in the document for this specific name replacing this tag with the content of this .doc name. Exemple, on the document am searching let's say we have this: testing.doc testing1.doc testing2.doc and the content of testing.doc = "this is testing document 1" content of testing1.doc = " this is another testing document number 2" content of testing2.doc = " and this is another one" Then after this loop, my document will look like this: this is testing document 1 this is another testing document number 2 and this is another one I've modifiy it to not use the with block and explicitly specify the whole syntax For i = 1 To 50 750 If TFDB(i) <> "" Then 760 oTargetDoc.Application.Selection.HomeKey unit:=wdStory 770 oTargetDoc.Application.Selection.Find.ClearFormatting 780 oTargetDoc.Application.Selection.Find.Text = TFDB(i) 790 oTargetDoc.Application.Selection.Find.Replacement.Text = "" 800 oTargetDoc.Application.Selection.Find.Forward = True 810 oTargetDoc.Application.Selection.Find.Wrap = wdFindStop 820 oTargetDoc.Application.Selection.Find.Format = False 830 oTargetDoc.Application.Selection.Find.MatchCase = True 840 oTargetDoc.Application.Selection.Find.MatchWholeWord = False 850 oTargetDoc.Application.Selection.Find.MatchWildcards = False 860 oTargetDoc.Application.Selection.Find.MatchSoundsLike = False 870 oTargetDoc.Application.Selection.Find.MatchAllWordForms = False 880 Do While oTargetDoc.Application.Selection.Find.Execute() 890 oWordApp.Selection.InsertFile _ FileName:=SUBSTITUTION_FOLDER & TFDB(i), Range:="", _ ConfirmConversions:=False, _ Link:=False, _ Attachment:=False 900 Loop End If 910 Next and now working fine. Thanks for all your help guy's Happy new year to all. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > OLE Automation error 462 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |