A
Amedee Van Gasse
I have written a small vb.net app that creates a Word and an Excel
file. I referenced Word, Excel and Office as COM-components.
The app does not work on a pc where Word or Excel are not installed.
According to this article:
http://www.devcity.net/Articles/89/1/spellcheck.aspx I added a
try/catch, like this:
Imports System.Runtime.InteropServices
Public Class MyApp
Private Sub MakeWordFile
Try
Dim wordApp As New Word.Application
' ... etcetera
Catch COMExcep As COMException
MessageBox.Show( _
"Microsoft Word must be installed for this application
" _
& "to run.", "MyApp")
Catch Excep As Exception
MessageBox.Show("An error has occurred.", "MyApp")
End Try
End Sub
End Class
The VS.NET IDE gives the following build errors:
The referenced component 'Word' could not be found. Could not load the
type library. DLL-bestand is niet geregistreerd.
The referenced component 'VBIDE' could not be found. Could not load the
type library. DLL-bestand is niet geregistreerd.
Type 'Word.Application' is not defined.
and so on
What is wrong here? I thought the Imports
System.Runtime.InteropServices and the Try/Catch would do the job?
file. I referenced Word, Excel and Office as COM-components.
The app does not work on a pc where Word or Excel are not installed.
According to this article:
http://www.devcity.net/Articles/89/1/spellcheck.aspx I added a
try/catch, like this:
Imports System.Runtime.InteropServices
Public Class MyApp
Private Sub MakeWordFile
Try
Dim wordApp As New Word.Application
' ... etcetera
Catch COMExcep As COMException
MessageBox.Show( _
"Microsoft Word must be installed for this application
" _
& "to run.", "MyApp")
Catch Excep As Exception
MessageBox.Show("An error has occurred.", "MyApp")
End Try
End Sub
End Class
The VS.NET IDE gives the following build errors:
The referenced component 'Word' could not be found. Could not load the
type library. DLL-bestand is niet geregistreerd.
The referenced component 'VBIDE' could not be found. Could not load the
type library. DLL-bestand is niet geregistreerd.
Type 'Word.Application' is not defined.
and so on
What is wrong here? I thought the Imports
System.Runtime.InteropServices and the Try/Catch would do the job?