943,712 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 14949
  • VB.NET RSS
Oct 13th, 2007
0

Create Add-in for Outlook 2007

Expand Post »
i have created add-in for Outlook 2007 . but when i run outlook the commandbar button which should be appear on standard bar , does not appear.
i think there is a problem in register of Add-in.
the code are as follows :
VB.NET Syntax (Toggle Plain Text)
  1. imports Extensibility
  2. Imports System.Runtime.InteropServices
  3. Imports Microsoft.Office.Core
  4. Imports Microsoft.Office.Interop
  5.  
  6.  
  7.  
  8. #Region " Read me for Add-in installation and setup information. "
  9. ' When run, the Add-in wizard prepared the registry for the Add-in.
  10. ' At a later time, if the Add-in becomes unavailable for reasons such as:
  11. ' 1) You moved this project to a computer other than which is was originally created on.
  12. ' 2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
  13. ' 3) Registry corruption.
  14. ' you will need to re-register the Add-in by building the $SAFEOBJNAME$Setup project,
  15. ' right click the project in the Solution Explorer, then choose install.
  16. #End Region
  17.  
  18. <GuidAttribute("F5F9500E-08F4-4391-B2F7-29FDE0BB4C23"), ProgIdAttribute("ISOLAddin.Connect")> _
  19. Public Class Connect
  20.  
  21. Implements Extensibility.IDTExtensibility2
  22.  
  23.  
  24. Dim applicationObject As Object
  25. Dim addInInstance As Object
  26. Dim WithEvents MyButton As Microsoft.Office.Core.CommandBarButton
  27. Dim OApp As Outlook.Application
  28.  
  29.  
  30.  
  31.  
  32. Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnBeginShutdown
  33. MsgBox("Our custom Add-in is unloading.")
  34. MyButton.Delete()
  35. MyButton = Nothing
  36. End Sub
  37.  
  38. Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnAddInsUpdate
  39. End Sub
  40.  
  41. Public Sub OnStartupComplete(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnStartupComplete
  42.  
  43.  
  44.  
  45. Dim ComBar As CommandBars
  46. Dim StdBar As CommandBar
  47. Dim OAppExpl As Outlook.Explorer
  48. OAppExpl = CType(OApp.ActiveExplorer, Outlook.Explorer)
  49.  
  50. ComBar = OAppExpl.CommandBars
  51. If ComBar Is Nothing Then
  52. ComBar = OApp.ActiveExplorer.CommandBars
  53. End If
  54.  
  55. ComBar = applicationObject.CommandBars()
  56. StdBar = ComBar.Item("Standard")
  57. If StdBar Is Nothing Then
  58. StdBar = ComBar.Item("Database")
  59. End If
  60.  
  61. MyButton = CType(StdBar.FindControl(Tag:="My Custom Button"), CommandBarButton)
  62.  
  63. If MyButton Is Nothing Then
  64. MyButton = CType(StdBar.Controls.Add(Type:=MsoControlType.msoControlButton, Temporary:=False), CommandBarButton)
  65.  
  66. With MyButton
  67. .Caption = "My Custom Button"
  68. .Style = MsoButtonStyle.msoButtonCaption
  69. .Tag = "My Custom Button"
  70. .OnAction = "!<ISOLAddin.connect>"
  71. .Visible = True
  72. End With
  73. End If
  74. MsgBox("Started in " & OApp.Name & ".")
  75.  
  76. ComBar = Nothing
  77. StdBar = Nothing
  78.  
  79.  
  80. End Sub
  81.  
  82. Public Sub OnDisconnection(ByVal RemoveMode As Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnDisconnection
  83. If RemoveMode <> ext_DisconnectMode.ext_dm_HostShutdown Then
  84. Call OnBeginShutdown(custom)
  85. End If
  86. OApp = Nothing
  87.  
  88. End Sub
  89.  
  90. Public Sub OnConnection(ByVal application As Object, ByVal connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
  91. MsgBox("On Connection In MyAddin")
  92. applicationObject = application
  93. addInInstance = addInInst
  94.  
  95. If connectMode <> ext_ConnectMode.ext_cm_Startup Then
  96. Call OnStartupComplete(custom)
  97. End If
  98.  
  99. End Sub
  100.  
  101. Private Sub MyButton_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Handles MyButton.Click
  102. MsgBox("Our CommandBar button was pressed!")
  103. End Sub
  104. End Class
please tell me , what is the problem in this ?

Thanks !
Last edited by Ancient Dragon; Feb 5th, 2009 at 6:47 pm. Reason: add code tags
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Sunny28525 is offline Offline
8 posts
since Sep 2007
Reputation Points: 10
Solved Threads: 0
Newbie Poster
luka_ghost is offline Offline
1 posts
since Apr 2008
Feb 5th, 2009
0

Re: Create Add-in for Outlook 2007

http://www.outlooktrackit.com <--- I love this toolbar, Outlook Track-It. I want to create something just like this that reminds the user to followup to emails. It's so simple...and perfect. Any suggestions???
Reputation Points: 11
Solved Threads: 2
Newbie Poster
ronjustincase is offline Offline
12 posts
since Dec 2008
Feb 5th, 2009
0

Re: Create Add-in for Outlook 2007

Yeah, let's not post to threads that are nearing a year old.....
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: deployment
Next Thread in VB.NET Forum Timeline: Datagrid MS Access and VB.Net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC