PDA

View Full Version : Outlook's OptionsPagesAdd Event



Marcster
12-04-2005, 11:21 AM
I've been looking at Outlook's object library :read2: and found the event called:
OptionsPagesAdd
which I find interesting :yes as implies I can add a tab to the Options dialog.
The event fires when you select the Options dialog box from the Tools menu.
I can make a messagebox appear when the event fires but what i'm
interested in is adding a new tab page to the Outlook's Options dialog.

I can create an ActiveX control using VB5 called OLTest.ocx.
Can I use a VBA form instead:question: :dunno.
How do I go about adding a custom tab to the Options dialog box?.
:anyone: :ipray:
Thanks,

Marcster.

Marcster
12-05-2005, 11:51 AM
I've solved this :content: by:

Creating an ActiveX control called Project1
In it the UserControl is called UserControl1
No need to add a reference to the OCX in project
as the OCX was compiled on this pc.
Added the following code in ThisOutlookSession

Option Explicit
Public WithEvents objOL As Outlook.Application

Private Sub Application_Startup()
Set objOL = Outlook.Application
End Sub

Private Sub Application_Quit()
Set objOL = Nothing
End Sub

Private Sub objOL_OptionsPagesAdd(ByVal Pages As PropertyPages)
'Options dialog box from the Tools menu
Dim strTabTitle As String
On Error Resume Next
strTabTitle = "Custom Tab" 'Tab title in Options dialog
Pages.Add "Project1.UserControl1", strTabTitle 'Attach tab
End Sub

Also, found out I can attach custom tabs to folder properties too :yes.

Marcster.

Marcster
12-05-2005, 12:04 PM
Hmmmmm, :thinking:
Now I'm trying to add some functionality to to the custom Tab.
I'm thinking about putting some code in the ActiveX control...
As if I have a checkbox on the Custom tab, how
can I check weather it's ticked or not via VBA?.
How do I go about checking and setting the value
of a ComboBox on the Custom tab via VBA?.

More research me thinks... :reading:

Marcster.

Marcster
12-09-2005, 03:51 AM
Hmmmm :think: , I'm trying to add a UserForm to the Options dialog...

Private Sub objOL_OptionsPagesAdd(ByVal Pages As PropertyPages)
'Options dialog box from the Tools menu
Dim strTabTitle As String
On Error Resume Next
strTabTitle = "Custom Tab" 'Tab title in Options dialog
Pages.Add "Project1.UserForm1", strTabTitle 'Attach UserForm to tab
End Sub

The above kinda adds the UserForm to the Options dialog as in,
there's a new tab called "Custom Tab" displayed but the following
message appears when I click on the tab:
Unable to display "Custom Tab" page. This page will remain visible, but is not available.

As yet, I'm unable to get the UserForm to correctly display.:banghead:

More research me thinks... :reading: :type

Marcster.

Marcster
12-09-2005, 04:05 AM
Found this:
http://www.vbip.com/books/1861003315/chapter_3315_04.asp
Which shows you how to add a custom tab to the Options dialog.
But the tab is an ActiveX control.
What I'm trying to do is add the tab as a UserForm. :yes

Reading the link it says:
You can also display a VB form or a VBA UserForm instead of a Property Page

Does anyone know the way to add a custom tab (a UserForm) to the Options dialog?. :dunno :help

Marcster.

Marcster
12-09-2005, 05:59 AM
Searched on MSDN: :type

COM Add-ins Part I: Introducing an Office 2000 Solution for the Entire (Office) Family:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2kta/html/msotrcom.asp

COM Add-ins Part II: Building a COM Add-in for Outlook 2000:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2kta/html/trcomad.asp

More reading to be done... :reading:

I'm sure i'll get there in the end... :dunno

Marcster.

Marcster
12-09-2005, 06:24 AM
Found out why the error message:
Unable to display "Custom Tab" page. This page will remian visible, but is not available.
appears.
I must explicitly make the custom property page visible to COM.
By default it does not.
How to fix this?... :help
Any ideas?... :creator:
Hmmmm.... :sleuth:
Marcster

Marcster
01-17-2006, 12:16 PM
Found this:
http://www.vbip.com/books/1861003315/chapter_3315_04.asp
Which shows you how to add a custom tab to the Options dialog.
But the tab is an ActiveX control.
What I'm trying to do is add the tab as a UserForm. :yes

Reading the link it says:
You can also display a VB form or a VBA UserForm instead of a Property Page

Does anyone know the way to add a custom tab (a UserForm) to the Options dialog?. :dunno :help

Marcster.

Does anyone know if it's possible to display a UserForm in Outlook's Options Dialog?. :dunno

Thanks,

Marcster.

eric@bargetz
02-06-2008, 01:29 PM
I am trying to do the exact same thing. I have VBA code all working but would like to have an options tab to make it easier to change some settings. I am also encountering the same issues. I will continue to monitor this thread and contribute anything I can.

Marcster
02-11-2008, 11:23 AM
Does anyone have any more info if this is possible?.

Marcster.