Issue with commandbar with Outlook 2003
Hi there,
I wrote this a while ago and now it is no longer working. The commandbar gets created with the proper item, except when you click on it, nothing happens.
I think the problem is the following line:
_fpItems = _mapiFormsFolder1.Items
_fpItem = _fpItems.Add("IPM.Note.Custom Form")
for _mapiFormsFolder1.Items, under the ErrorCode it shows -1213988351. I've tried searching for that error, but I can't find anything about it. Any ideas what that means?
Also, I see the following message
"Item = In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user."
I don't know what to do to fix this. Any help would be greatly appreciated. Thank you in advance.
Arsi
Here's the code below:
Imports Office = Microsoft.Office.Core
Imports System.Xml
Imports System.IO
Imports System.Configuration
Imports System.Collections
Imports System.Net
publicclass ThisApplication
PrivateWithEvents _Explorers As Outlook.Explorers
PrivateWithEvents _Explorer As Outlook.Explorer
Private _mapiFormsFolder1 As Outlook.MAPIFolder
Private _fpItems As Outlook.Items
Private _fpItem AsObject
Private _helpMenuIndex AsObject
Private _topMenu As Office.CommandBarPopup
PrivateWithEvents _OpenForm As Office.CommandBarButton
Private _menuBar As Office.CommandBar
PrivateConst _MENU_BEFORE AsString = "Help"
PrivateSub ThisApplication_Startup(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Startup
_Explorer = Me.ActiveExplorer()
_mapiFormsFolder1 = Me.ActiveExplorer().Session.GetDefaultFolder(Outlook .OlDefaultFolders.olPublicFoldersAllPublicFolders) .Folders("CORPORATE").Folders("Our Forms")
BuildTopMenu()
EndSub
PrivateSub BuildTopMenu()
_menuBar = Me.ActiveExplorer().CommandBars.ActiveMenuBar
_helpMenuIndex = _menuBar.Controls(_MENU_BEFORE).Index
_topMenu = CType(_menuBar.Controls.Add(Office.MsoControlType.msoCo ntrolPopup, , , _helpMenuIndex, True), Office.CommandBarPopup)
_topMenu.Caption = "Our Forms"
_topMenu.Visible = True
_OpenForm = CType(_topMenu.Controls.Add(Office.MsoControlType.msoCo ntrolButton, , , , True), Office.CommandBarButton)
_OpenForm.Caption = "Custom Form"
_OpenForm.Visible = True
_OpenForm.Enabled = True
EndSub
PrivateSub Menu_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault AsBoolean) Handles _OpenForm.Click
Try
_fpItems = _mapiFormsFolder1.Items
_fpItem = _fpItems.Add("IPM.Note.Custom Form")
Catch ex As Exception
MessageBox.Show(ex.Message)
EndTry
EndSub
PrivateSub ThisApplication_Shutdown(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Shutdown
EndSub
Endclass
__________________
*******(*)*******
|