Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 25th, 2003, 11:15 PM
R2D2 R2D2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Third chipset next to the master jumper...
Posts: 16 R2D2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old December 26th, 2003, 09:12 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
When u get this wrong after u run your code??Plz give a part of the code where worng happened!...

Reply With Quote
  #3  
Old December 26th, 2003, 03:54 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,976 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 17 h 59 m 48 sec
Reputation Power: 802
Did you register your vb dll on the web server successfully?

Reply With Quote
  #4  
Old December 26th, 2003, 09:20 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
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

Reply With Quote
  #5  
Old December 27th, 2003, 09:51 PM
R2D2 R2D2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Third chipset next to the master jumper...
Posts: 16 R2D2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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
Attached Files
File Type: zip oleerror.zip (5.1 KB, 240 views)

Reply With Quote
  #6  
Old December 27th, 2003, 09:55 PM
R2D2 R2D2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Third chipset next to the master jumper...
Posts: 16 R2D2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #7  
Old December 28th, 2003, 02:10 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
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..

Reply With Quote
  #8  
Old December 28th, 2003, 02:18 AM
R2D2 R2D2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Third chipset next to the master jumper...
Posts: 16 R2D2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #9  
Old December 28th, 2003, 04:27 AM
R2D2 R2D2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Third chipset next to the master jumper...
Posts: 16 R2D2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
@Cleverpig, I presume you where joking me... at least I hope so... :-)

Reply With Quote
  #10  
Old December 28th, 2003, 03:56 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
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.

Reply With Quote
  #11  
Old December 28th, 2003, 07:20 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
The same error in word application develop period:http://oldlook.experts-exchange.com...Q_20753661.html
Hope it give us some revelation.

Reply With Quote
  #12  
Old December 28th, 2003, 09:15 PM
R2D2 R2D2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Third chipset next to the master jumper...
Posts: 16 R2D2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
@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

Reply With Quote
  #13  
Old December 29th, 2003, 07:55 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
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.

Reply With Quote
  #14  
Old December 30th, 2003, 10:55 AM
R2D2 R2D2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Third chipset next to the master jumper...
Posts: 16 R2D2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > OLE Automation error 462


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread: