cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

VBA Hook in Excel View

OliverA41
Active Participant
0 Kudos
1,797

Hello,

I have an IBP Excel Sheet and I want insert an VBA code. It should be start, if I push the button "update"

First I insert in the global parameter "ACTIVATE_VBA_HOOKS" my hook "IBPAfterRefresh". I hope, this was correct.

Then I want an MSGbox "update correct"

the code is follow

Function

IBPAfterRefresh() MsgBox ("update correct")

Endfunction

But where I have to insert this code in VBA. direct under the sheet, it is not working. I have a modul called "EPMafterREFRESH" it is not correct working. The issue is, that then the msgbox create every time, if I push the update button in every sheet and i sould be only in sheet price

Regards

Oliver

Accepted Solutions (1)

Accepted Solutions (1)

former_member194529
Active Contributor
0 Kudos

Hi Oliver,

It must be saved and distributed separately on that case. You should place it at the same directory where the SAP_IBP_Chart.xlam main VBA Add-in is placed, that is:

%appdata%\Microsoft\AddIns

Best,

Ivan

Answers (3)

Answers (3)

ajayprakash
Explorer

Hi Oliver,

The VBA code can be part of planning view templates or can be called from a separate .xlam add-in. SAP recommends putting the code to an .xlam add-in for easier maintainability. You can refer to SAP_IBP_VBA_Hook.xlam which can be downloaded from the SAP marketplace.

Prerequisites to implementing planning view VBA Hooks is maintaining ACTIVATE_VBA_HOOKS in parameter group PLAN_VIEW of global configurations.

If you want to restrict the VBA code execution to one sheet I would suggest putting a check of the sheet name. eg. If <worksheet>.Name = "price". Although, I would suggest you not to hardcode it in the code.

Thanks

Ajay

OliverA41
Active Participant
0 Kudos

Hello Ajay,

thanks for the reponse.

For it is now more clearly. But how and where I store the SAP_IBP_VBA_HOOK File.

For me it sounds, that this file automatically connected with the "normal" planning view" and everybody who use the planning view will use automatically the SAP_IBP_VBA_HOOK.

Right?

or must it be saved separately

Regards

Oliver

amandeepnagpal
Discoverer
0 Kudos

Hi Oliver,

For every user, the Add-in must be saved separately in their Laptops / Desktops in the folder : "%appdata%\Microsoft\AddIns" [Click Win+R button and enter the path]

Thanks

Aman

OliverA41
Active Participant
0 Kudos

Hi Aman,

thanks for the response. But furthermore it have to added as Add-In about Excel option - Add-In

Regards

Oliver

OliverA41
Active Participant
0 Kudos

Hello Ajay,

this was helpful. I saw before this xlam file, but I don't know, how I can my planning view "connect" with the SAP_IBP_VBA_Hook.xlam.

For example, I want, that after the update an MSGbox will be appear. I have the code insert into the SAP_IBP_VBA_Hook.xlam sheet. where and which code I need in the planning view and how I have to save the SAP_IBP_VBA_Hook.xlam code.

Thanks in advance

Oliver

ajayprakash
Explorer
0 Kudos

Oliver,

You don't need to do any connections. The VBA hooks will automatically be called. You need to make sure that the SAP_IBP_VBA_Hook.xlam is active, just like your IBP Add-in for excel.

I would suggest you to through the below KBA for details of available functions in details

KBA 2421657

Thanks

Ajay