cancel
Showing results for 
Search instead for 
Did you mean: 

How to add marcos

Former Member
0 Kudos
146

I want to add a macro to run on after expantion. The help give the following syntax

AFTER_EXPAND(Argument As String)

MsgBox Argument

AFTER_EXPAND = True

End Function

Many of the MNU commands appear to be intended to run from a button.

The AFTER_EXPAND appears to be event driven. I want to execute some code after the expansion event. I assume I put my code into the function above. Where do I put the function to ensure it gets executed? I tried adding it to sheet 1 (data cache) and the VBA came p as invalid syntax

I added the word "function" to the start and the error went away but there is no evidence the macro is invoked when I expand my schedule.

I need guidance getting started.

Thanks

Cliff

Accepted Solutions (1)

Accepted Solutions (1)

krishna_priya1
Contributor
0 Kudos

Create a module in VBA and just place this function with code there . Then AFTER_EXPAND definitely gets triggered. For testing ,just try simple code first.


AFTER_EXPAND(Argument As String)
MsgBox " AFTER_EXPAND is triggered" 
AFTER_EXPAND = True
End Function

Hope this helps.

Former Member
0 Kudos

I have my answer. P Krishnas was helpful but already knew how to display my own message and that was how i knew the code was not being invoked. There were two things I was missing;

The first thing was I had to preceed the first line of code with the word "function". The help (for version 7) missed this key word

The second was I had to put the code in a module rather than in Sheet 1.

As soon as I moved it there

Cheers

Cliff

Answers (0)