473,387 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

I am using the attached code

Private Sub StartApplicationProcess
InitialiseObject()
oWord.Visible = True
oDoc = oWord.Documents.Open(StrStackPath)
oWord.Visible = True
end sub

The variables oWord and oDoc are declared in the class as below
attached

Private WithEvents oWord As Word.Application
Private WithEvents oDoc As Word.Document

The sub InitialiseObject() has the below code

Private Sub InitialiseObject()
oWord = New Word.Application
End Sub

Ok, lets start! I am having a very strange issue. I am creating a word
document using the documents.add method and I close word using
the .Quit method, then I am calling the sub StartApplicationProcess
(shown above). On the first instance everything goes well and the
document is launch as per my requirements. However when I launch again
the document I am having The RPC server is unavailable. (Exception
from HRESULT: 0x800706BA) in line "oDoc =
oWord.Documents.Open(StrStackPath)" in sub StartApplicationProcess. I
can't understand this error since I am still initialising the object
oWord. Why he can't find the word to launch the document? Funnily
enough, if I declare the oWord and the oDoc inside the sub
StartApplicationProcess itself, I will not get the error and the
document is open, but I can't afford of declaring a local variable
since as shown above the variables are also being used to handle
events. I also tried moving the code oWord = New Word.Application from
the sub InitialiseObject to sub StartApplicationProcess but vb.net
failed again.

This is happening with office 2003.

Your suggestion will be greatly appreciated since I really don't know
how to handle this issue.

Thanks

Apr 19 '07 #1
1 18881
Further to this I've done so more troubleshooting and here are my
results

Noticed that the issue is coming from the variable oWord. As shown
below the variable oWord is declared at the top level of the class as
Private WithEvents oWord As Word.Application. The word docuement is
opening in a normal manner. When it is closed the event is raised and
therefore the document is closed. In the StartApplicationProcess the
code is getting stuck in the code line oDoc =
oWord.Documents.Open(StrStackPath). The rpc server is unavailable
error shows that you cannot open a document if the word application is
open. In my case the word application is open and visible, and if I
watch the oWord variable it shows that it has been defined to open. If
I change the oWord.visible = false, the word application will hide.
This is another prove that oWord variable has been assigned to the
word.application. If I execute the code oWord.Documents.add the error
RPC server is again there

If I don't trigger the odoc.close event the program will work normally
and it will not stop if I try to open the document for x amount of
times.

Do you have any ideas what's happening here?

Thanks again

ta*********@hotmail.com wrote:
I am using the attached code

Private Sub StartApplicationProcess
InitialiseObject()
oWord.Visible = True
oDoc = oWord.Documents.Open(StrStackPath)
oWord.Visible = True
end sub

The variables oWord and oDoc are declared in the class as below
attached

Private WithEvents oWord As Word.Application
Private WithEvents oDoc As Word.Document

The sub InitialiseObject() has the below code

Private Sub InitialiseObject()
oWord = New Word.Application
End Sub

Ok, lets start! I am having a very strange issue. I am creating a word
document using the documents.add method and I close word using
the .Quit method, then I am calling the sub StartApplicationProcess
(shown above). On the first instance everything goes well and the
document is launch as per my requirements. However when I launch again
the document I am having The RPC server is unavailable. (Exception
from HRESULT: 0x800706BA) in line "oDoc =
oWord.Documents.Open(StrStackPath)" in sub StartApplicationProcess. I
can't understand this error since I am still initialising the object
oWord. Why he can't find the word to launch the document? Funnily
enough, if I declare the oWord and the oDoc inside the sub
StartApplicationProcess itself, I will not get the error and the
document is open, but I can't afford of declaring a local variable
since as shown above the variables are also being used to handle
events. I also tried moving the code oWord = New Word.Application from
the sub InitialiseObject to sub StartApplicationProcess but vb.net
failed again.

This is happening with office 2003.

Your suggestion will be greatly appreciated since I really don't know
how to handle this issue.

Thanks
Apr 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lekyan | last post by:
I have problem setting the password for an ADAM user using C#. I used the SetPassword code given in the Microsoft page, changed several parameters, but ran into an exception. I wonder if other...
5
by: Jan | last post by:
Hi, If I put a try catch block for Server.Transfer call. It will catch a System.Threading.ThreadAbortException exception like this. However, it transfer the page to the correct page. Why did...
1
by: robby valles | last post by:
My company has a large windows form app with the datalayer being webservices. pretty randomly the webservice calls will either be very slow or i'll get the server unavailable. there are times when...
1
by: pphadke | last post by:
I have an application that was originally in asp but is now moved to ASP.Net. To deploy it, I just changed the default file in IIS for the web folder to point to the new aspx file. Occasionally I...
17
by: Jon B | last post by:
Hi All! I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However, when I tried to view this site on my local Windows XP machine, I get "Server Unavailable". If I switch the...
2
by: sgr | last post by:
Hello I'm making an application that uses an excel worksheet, My problem appears when I open the worksheet to see the data (then I close it and save the changes) and I try to insert a new row from...
1
by: John Braham | last post by:
I hope someone can hep with this! I have a winform (VB.NET 2005), containing a tab control, which in turn contains a few standard controls and one custom control, the form used to work fine,...
2
by: ciffycyclops | last post by:
Hello.. i am using WIndows XP Professional service pack 2 in my client m/c as well as in server..i diasabled the firewall in both the local and remote computer..but it shows the following error"RPC...
2
by: kenski | last post by:
Hello, I'm new here hopefully i did not broke any rules already, Here's the problem, I'm getting the OUT OF MEMORY exception/SERVER UNAVAILABLE error when fetching large amounts of data in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.