H
Hans-Joachim
This item is moved from "Visual Studio Tools for Office" to here.
Hi Chaps,
I'm using this snipped code in Visual Basic 2005 with one problem.
On my development PC Win XP-SP2; Visual Basic 2005; Office 2003-SP2 this
code is working well. On a different PC with same configuration (except VS
2005) I'm running into an error called: "The RPC server is unavailable.
(Exception from HRESULT: 0x800706BA)". The goal of my code is just to analyse
to page no in a Word document.
Does someone has an idea what coused the problem?
---------------------------------
Imports Word = Microsoft.Office.Interop.Word
Module mdl_TEST
Public WordApp As Word.Application 'Class
Public WordDoc As Word.Document
Public Function TEST(ByVal sPfad As String) As Short
Dim m As Object = System.Reflection.Missing.Value
Dim PageNo As Short
Try
WordApp = New Word.Application
WordApp.Visible = False
WordDoc = WordApp.Documents.Open(sPfad, m, False, m, m, m, m, m, m,
m, m, m)
'determine Page#
PageNo =
WordDoc.ComputeStatistics(Microsoft.Office.Interop.Word.WdStatistic.wdStatisticPages)
WordDoc.Close()
WordDoc = Nothing
WordApp.Quit(m, m, m)
Catch ex As Exception
'error routine...
End Try
End Function
End Module
Hi Chaps,
I'm using this snipped code in Visual Basic 2005 with one problem.
On my development PC Win XP-SP2; Visual Basic 2005; Office 2003-SP2 this
code is working well. On a different PC with same configuration (except VS
2005) I'm running into an error called: "The RPC server is unavailable.
(Exception from HRESULT: 0x800706BA)". The goal of my code is just to analyse
to page no in a Word document.
Does someone has an idea what coused the problem?
---------------------------------
Imports Word = Microsoft.Office.Interop.Word
Module mdl_TEST
Public WordApp As Word.Application 'Class
Public WordDoc As Word.Document
Public Function TEST(ByVal sPfad As String) As Short
Dim m As Object = System.Reflection.Missing.Value
Dim PageNo As Short
Try
WordApp = New Word.Application
WordApp.Visible = False
WordDoc = WordApp.Documents.Open(sPfad, m, False, m, m, m, m, m, m,
m, m, m)
'determine Page#
PageNo =
WordDoc.ComputeStatistics(Microsoft.Office.Interop.Word.WdStatistic.wdStatisticPages)
WordDoc.Close()
WordDoc = Nothing
WordApp.Quit(m, m, m)
Catch ex As Exception
'error routine...
End Try
End Function
End Module