Consulting

Results 1 to 10 of 10

Thread: Outlook's OptionsPagesAdd Event

  1. #1
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location

    Question Outlook's OptionsPagesAdd Event

    I've been looking at Outlook's object library and found the event called:
    OptionsPagesAdd
    which I find interesting 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 .
    How do I go about adding a custom tab to the Options dialog box?.

    Thanks,

    Marcster.

  2. #2
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location

    Smile

    I've solved this 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
    [VBA]
    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
    [/VBA]
    Also, found out I can attach custom tabs to folder properties too .

    Marcster.
    Last edited by Marcster; 12-05-2005 at 12:06 PM. Reason: Error in code. Now updated.

  3. #3
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Hmmmmm,
    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...

    Marcster.

  4. #4
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Hmmmm , I'm trying to add a UserForm to the Options dialog...
    [VBA]
    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
    [/VBA]
    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.

    More research me thinks...

    Marcster.
    Last edited by Marcster; 12-09-2005 at 04:22 AM. Reason: Spelling mistake.

  5. #5
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Found this:
    http://www.vbip.com/books/1861003315...er_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.

    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?.

    Marcster.

  6. #6
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Searched on MSDN:

    COM Add-ins Part I: Introducing an Office 2000 Solution for the Entire (Office) Family:
    http://msdn.microsoft.com/library/de...l/msotrcom.asp

    COM Add-ins Part II: Building a COM Add-in for Outlook 2000:
    http://msdn.microsoft.com/library/de...ml/trcomad.asp

    More reading to be done...

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

    Marcster.

  7. #7
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    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?...
    Any ideas?...
    Hmmmm....
    Marcster

  8. #8
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Quote Originally Posted by Marcster
    Found this:
    http://www.vbip.com/books/1861003315...er_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.

    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?.

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

    Thanks,

    Marcster.

  9. #9
    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.

  10. #10
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Does anyone have any more info if this is possible?.

    Marcster.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •