cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering a macro in Excel when a workbook is updated

Former Member
0 Kudos

Not sure if this is ramp-up but since I'm doing this on a 04s system I figure I would post it here.

I have a vb program that formats the workbook. I want to execute this everytime the workbook refreshes with data. Does anyone know where I can make the call to the macro?

Thank you,

Dae Jin

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

did you ever get the excel VB macro to execute after refresh ? if so please share code. do you use "invoke macro after refresh" setting ?

Former Member
0 Kudos

Here is what I found out....

You can create your own macro that will have the same functionality as in 3.x SAPBEXonRefresh. What I did was created a macro "format(queryID As String, resultArea As Range)" in "Modul1". In the Workbook Settings "exit" tab enter the name of the macro "format". Press OK. Now whatever code that is in macro format will execute when the workbook refreshes.

The "Attach Macro" button is a different functionality that is not fully functional at this time.

Former Member
0 Kudos

Hi Dae,

I intend to use a Macro to format my workbook. I have created a macro by name "Format" now I wrote the name in the "Exits" tab of "Workbook Settings" and clicked "Attach Macro" and clicked "OK". Then I saved the workbook. Now when I reopen the workbook and refresh the workbook query there is no effect of the Macro.

Please suggest how I can make this macro work.

Thanks

Kumar

former_member619464
Active Contributor
0 Kudos

Hi,

I hope the following links may help u

http://www.techonthenet.com/excel/macros/refresh_pt2.htm

http://www.dicks-blog.com/archives/2004/09/27/ask-to-refresh/

Also refer this thread

Regards,

R.Ravi

Former Member
0 Kudos

Hi Dae,

Check this previous thread on the same issue.

Assign Points if this helps

Cheers,

Aravindhan

Former Member
0 Kudos

Thanks for the links but it seems there some changes in 04s addins. There no longer is a macro sapbexDebugPrint nor is there a routine

Sub SAPBEXonRefresh(queryID As String, resultArea As Range)

End Sub

There is a SAPBEXrefresh but I'm not sure when this is getting called. Looks like I will have test some more. Thanks for you help guys.

Dae Jin

Former Member
0 Kudos

FYI...

There is actually a place in workbook properties that you can place a macro name to execute when the workbook refreshes.

If you go to Design Mode and select Workbook Settings, a popup screen appears and in the tab Exits you enter a macro name. Unfortunately, it is not working properly at this time nor is the attach macro button.

Dae Jin

Former Member
0 Kudos

SAPBEXrefresh is available instead of SAPBEXonrefresh. You can enter the macro name manually within this function for refresh....