I'm tring to use Microsoft.Office.Interop.Outlook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to develop a aplication with VB.2003 and Microsoft outlook 2003.

I have this code.

Imports OutLook = Microsoft.Office.Interop.Outlook
Imports System.Reflection


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim oApp As OutLook.Application = New OutLook.Application
End Sub
But when Button1_Click is Execute I reveived a error. What is missing in
this code?
 
Miguel,
What specifically is the error you get.

Try
Dim oApp As OutLook.Application = New OutLook.Application
Catch ex As Exception
MessageBox.Show(ex.ToString(), "OutLook.Application")
End Try

What does the MessageBox show? (instead of MessageBox.Show, you can use
Debug.WriteLine so you can cut & paste the complete exception text into your
response.
 
Here is the error.

An unhandled exception of type 'System.Security.SecurityException' occurred
in system.windows.forms.dll

Additional information: Security error.

The try doesn't caught the error.

Jay B. Harlow said:
Miguel,
What specifically is the error you get.

Try
Dim oApp As OutLook.Application = New OutLook.Application
Catch ex As Exception
MessageBox.Show(ex.ToString(), "OutLook.Application")
End Try

What does the MessageBox show? (instead of MessageBox.Show, you can use
Debug.WriteLine so you can cut & paste the complete exception text into your
response.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


Miguel Arenas said:
I want to develop a aplication with VB.2003 and Microsoft outlook 2003.

I have this code.

Imports OutLook = Microsoft.Office.Interop.Outlook
Imports System.Reflection


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim oApp As OutLook.Application = New OutLook.Application
End Sub
But when Button1_Click is Execute I reveived a error. What is missing in
this code?
 
Back
Top