T
tamasumalta
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
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