Lets create Outlook 2007 Add-In using Visual Studio 2005.
If you have not installed VSTO then Download Microsoft Visual Studio 2005 Tools for Office Second Edition Runtime (VSTO 2005 SE) (x86).
Start IDE.
Click on File, New project
Select Outlook Add-In and Click on OK.
you will find some code like this:
Public Class ThisAddIn
Now add following code in StartUp event:
Done.
Now, Just run the project. Press F5, Outlook will automatically start and It will show a button there, and click on that button. See below "saAction Button" and messagebox.
Outlook is a very big application and using VSTO, you can utilize it's functions.
If you have not installed VSTO then Download Microsoft Visual Studio 2005 Tools for Office Second Edition Runtime (VSTO 2005 SE) (x86).
Start IDE.
Click on File, New project
Select Outlook Add-In and Click on OK.
you will find some code like this:
Public Class ThisAddIn
Private WithEvents btn1 As Office.CommandBarButtonPrivate Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
End Sub
Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ShutdownEnd Sub
End Class
Now add following code in StartUp event:
Dim explorer As Outlook.Explorer = Me.Application.ActiveExplorer()And declare Button click event any where in the class.If explorer IsNot Nothing Then
Dim bar As Office.CommandBar = explorer.CommandBars.Add("saAction Bar", Temporary:=True)
bar.Visible = True
btn1 = bar.Controls.Add(Office.MsoControlType.msoControlButton, Temporary:=True)btn1.Caption = "saAction Button"
btn1.Tag = "myOutlookAddin1.btn1"
btn1.Style = Office.MsoButtonStyle.msoButtonCaption
End If
Private Sub Btn1_Click(ByVal ctrl As Office.CommandBarButton, ByRef cancelDefault As Boolean) Handles btn1.ClickMsgBox("Hi! this is VSTO")
End Sub
Done.
Now, Just run the project. Press F5, Outlook will automatically start and It will show a button there, and click on that button. See below "saAction Button" and messagebox.
Outlook is a very big application and using VSTO, you can utilize it's functions.
Hmmm, for me it doesn't work.
ReplyDeleteOutlook 2007 launches, but there is no button, and none of my break points are hit.
Chris
Me too Chris
ReplyDeleteI am using C#
I'm running it in VS 2008 and it works fine
ReplyDeletethe font is unreadable on your page.
ReplyDelete