Skip to Content
0
Oct 14, 2011 at 11:24 AM

Where to initialize boolean in BEx VB Macro code?

34 Views

All,

I have created a BEx workbook with 4 worksheets. On the first worksheet I have a button that executes an IP (Integrated Planning) function. My requirement is to call the functionality behind that button in the VB code upon opening of the workbook and upon changing variable values.

I call the button in the CallBack routine of the DefaultWorkbook in VB. But the code behind that button actually triggers the execution of the CallBack routine and thus causes an endless loop. Also I have 4 worksheets and the CallBack routine gets called (I think) for every worksheet), And I want the functionality of the button only to run once after the variable pop up screen (thus after changing the variable values). So I created a boolean and set it to TRUE in the Sub Workbook_Open(). And made the call of the button dependant on that boolean and set it to FALSE afterwards.

This all works ok when I first open my workbook, populate the variables in the pop up. The functionality behind the button gets executed (ie some key figures get populated in the planning sheet). But then when I hit button 'Change Variable Values' the button is not called again. This is becasue my boolean is still FALSE. So obvioulsy the Sub Workbook_Open() is not called after 'Change Variable Values' and thus boolean not set to TRUE again.

Does anyone know where I should set the Boolean to TRUE so that after 'Change Variable Values' it is set to TRUE, but that it happens before the CallBack routine is called?

Cheers!