first of all sorry for the probably stupid question, but I am very new to VBA. Here is the question:
I added a simple checkbox in my custom ribbon tab
The MS Project file implements this function:
Private Sub Project_Open(ByVal pj As Project)
AppInit.Initialize_App
End Sub
I then have a module "AppInit" which defines my functions:
Public g_bIsAutoUpdateSched As Boolean
Public Sub Initialize_App()
Dim ribbonXml As String
UpdateSettings
ribbonXml = "<mso:customUI xmlns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">"
ribbonXml = ribbonXml + " <mso:ribbon>"
ribbonXml = ribbonXml + " <mso:qat/>"
ribbonXml = ribbonXml + " <mso:tabs>"
ribbonXml = ribbonXml + " <mso:tab id=""myTab"" label=""CIG"" insertBeforeQ=""mso:TabFormat"">"
ribbonXml = ribbonXml + " <mso:group id=""gUpdate"" label=""Update"" autoScale=""true"">"
ribbonXml = ribbonXml + " <mso:checkBox id=""cbUpdateSprints"" label=""Auto schedule goals"" getPressed=""Function_Checked"" onAction=""Function_Action"" />"
ribbonXml = ribbonXml + " </mso:group>"
ribbonXml = ribbonXml + " </mso:tab>"
ribbonXml = ribbonXml + " </mso:tabs>"
ribbonXml = ribbonXml + " </mso:ribbon>"
ribbonXml = ribbonXml + "</mso:customUI>"
ActiveProject.SetCustomUI (ribbonXml)
End Sub
Sub Function_Checked(control As IRibbonControl, ByRef pressed)
pressed = True
End Sub
Sub Function_Action(control As IRibbonControl, pressed As Boolean)
g_bIsAutoUpdateSched = pressed
End Sub
I searched the web for this and its implemented the same everywhere (similar to what I did). However when I run my code I get the following error:
Automation error Exception occured.
Removing the arguments from both functions fixes it?
Sub Function_Checked()
End Sub
Sub Function_Action()
End Sub
However that obviously defeats the entire purpose as I want set the default state, and also be able to get the state of that button...
Any help would be appreciated!