Consulting

Results 1 to 5 of 5

Thread: call stack question?

  1. #1

    call stack question?

    hi all,
    does anyone know if it is possible to determine if a particular sub or function has been called programmatically and use it as a boolean value (or assign it a varible)?
    would this be a scripting process vs a vba process?
    is it a crazy idea?
    thank you.

  2. #2
    Called programmatically as opposed to what?
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    Quote Originally Posted by Jan Karel Pieterse
    Called programmatically as opposed to what?
    i have a function that more than one sub goes to. i would like to create some kind of program flow control based on which sub called the function.

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Something like
    [vba]
    Option Explicit

    Sub Test1()
    Call MyTest(1)
    End Sub

    Sub Test2()
    Call MyTest(2)
    End Sub

    Sub MyTest(data As Long)
    Select Case data
    Case 1
    'do something
    Case 2
    'do something else
    Case Else
    'do nothing
    End Select
    End Sub

    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    hi md,
    i will give it a try.
    thank you.
    erik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •