'Defines the items exposed when using a custom front-end

Public Sub CustomizeFrontEnd_CustomFrontEndItem(ByVal lCustomItem As Long, sPluginProgID As String, vReserved As Variant)

   'lCustomItem          : index of custom item to define

   'sPluginProgID        : Programatic ID of a registerred plug-in which will serve as an available item in then front-end of the application

   'vReserved            : reserved

   Dim oSession As IBBSessionContext

   Dim oUtility As IBBUtilityCode

   Dim oService As REServices

   'NOTE: see comments in CustomizeFrontEnd_UseCustomFrontEnd

   On Error GoTo ErrHandler

   'Using the IBBSessionContext, REServices, and oUtility to verify user to

   'use the customfrontend

   Set oSession = REApplication.SessionContext

   Set oService = New REServices

   oService.Init oSession

   Set oUtility = oService



   'I added a user of Ron for testing purposes, you will want to use a function to check your log

   

   If UCase(oUtility.GetUserName(oSession.CurrentUserID)) = "RON" Then

       'in your case you might not need to place multiple items on your

       'customfrontend but I put the code in so you could see it.

       'in that case you will only need case 1

       If (lCustomItem > 0) Then

           Select Case lCustomItem

               Case 1

                   sPluginProgID = "HTTP://WWW.BLACKBAUD.COM"

               Case 2

                   sPluginProgID = "RE7DOCS.CPLUGINDOCHANDLER"

           End Select

           lCustomItem = lCustomItem - 1

       End If

   End If

   'closing everything down

   Set oUtility = Nothing

   oService.CloseDown

   Set oService = Nothing

   Set oSession = Nothing





   On Error GoTo 0



   Exit Sub



ErrHandler:

   Dim sErr As String

   sErr = Err.Description

   On Error GoTo 0

   '< place your custom error handling code here >

   MsgBox "Error processing CustomizeFrontEnd_CustomFrontEndItem : " & sErr



   Exit Sub



End Sub



'Allows you to replace the functionality exposed by the standard application front-end with your own

Public Sub CustomizeFrontEnd_UseCustomFrontEnd(bUseCustomFrontEnd As Boolean, bReplaceFrontEnd As Boolean, lNumCustomItems As Long)

   'bUseCustomFrontEnd   : if set to true, lNumCustomItems must be greater than zero

   'bReplaceFrontEnd     : if set to true the only the front-end customizations you define will be available in the application, if set to false, your customizations will be appended to the existing items in the application

   'lNumCustomItems      : specifies the number of custom items provided



   'Using these object to confirm correct user

   Dim oSession As IBBSessionContext

   Dim oUtility As IBBUtilityCode

   Dim oService As REServices

   'NOTE: the initial value of lNumCustomItems indicates the number

   'of custom items already defined by other VBA Customizations.  In

   'order for your customizations to work correctly with others, you

   'will need to cache this value (ie in a module level variable)

   On Error GoTo ErrHandler



   Set oSession = REApplication.SessionContext

   Set oService = New REServices

   oService.Init oSession

   Set oUtility = oService



   'I added a user of Ron for testing purposes, you will want to create a function to check your log

   

   If UCase(oUtility.GetUserName(oSession.CurrentUserID)) = "RON" Then



       bUseCustomFrontEnd = True 'uncomment this line to customize the front end

       bReplaceFrontEnd = True   'uncomment this line if your customizations will replace all standard functionality



       lNumCustomItems = 2 'assigning how many items the customfrontend will have

                           'This is the reason I have Case 1 and Case 2 in CustomizeFrontEnd_CustomFrontEndItem

                           'if you only want 1 item set equal to 1

   End If



   Set oUtility = Nothing

   oService.CloseDown

   Set oService = Nothing



   Set oSession = Nothing



   On Error GoTo 0



   Exit Sub



ErrHandler:

   Dim sErr As String

   sErr = Err.Description

   On Error GoTo 0

   '< place your custom error handling code here >

   MsgBox "Error processing CustomizeFrontEnd_UseCustomFrontEnd : " & sErr



   Exit Sub



End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.