Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default Calling macro?

On Mar 13, 2:05*pm, "Rick Rothstein"
wrote:
if your AnotherMacro [...] it will only be called from
within other code, then you can give it an argument and
pass the calling routine's name through it.

[....]
Another possibility is to use a global variable to
transmit the name... this method can be used with real
macros as well as subroutines.


Notwithstanding what I explained regarding symbol tables in general, I
do agree with you that it is probably better to use one of these
mechanisms instead of relying on any programming interface that VBA or
the kernel might provide.

In fact, for most purposes, I would not pass a name at all, except for
debugging/logging purposes. Instead, I would pass a number, which the
called procedure might use to alter its behavior.

One benefit of relying on a number (or arbitrary string) instead of
the caller's name is that procedure names have a habit of changing
over time ;-). Moreover, it allows multiple callers to affect the
same conditional behavior, which should be defined in a "functionally
cohesive" manner independent of a caller's name.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a public Macro from a Private Macro thewizz Excel Programming 6 November 2nd 07 10:23 PM
Calling XLA Macro from DLL. T G Excel Programming 3 November 21st 06 07:37 AM
calling next macro Michelle Hanan Excel Programming 1 July 18th 06 06:17 PM
Calling a macro from a key RWN Excel Programming 0 February 8th 05 05:19 AM
Calling macro in add-in. Clark B Excel Programming 1 July 24th 03 11:05 PM


All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"