+ Reply to Thread
Results 1 to 5 of 5

Call Event and Load Form based on Variable

  1. #1
    Resant
    Guest

    Call Event and Load Form based on Variable

    Hi all,
    I have some problem with dynamic things :
    1) I need to call an event which the event name was saved in a
    variable.
    Eg :
    Dim sEventName as String
    sEventName = "Button1_Click"

    Call sEventName

    2) And how to load Form based on variable too?
    Eg :
    Dim sFormName as String
    sFormName = "Form1"

    Load sFormName

    Hope someone can help me to solve the problems.

    Thanks a lot!

    Resant


  2. #2
    Tom Ogilvy
    Guest

    Re: Call Event and Load Form based on Variable

    use Application.run

    Application.Run sEventName


    http://support.microsoft.com/kb/157609/en-us
    XL97: How to Display a UserForm Whose Name Is in a Variable

    --
    Regards,
    Tom Ogilvy




    "Resant" <[email protected]> wrote in message
    news:[email protected]...
    > Hi all,
    > I have some problem with dynamic things :
    > 1) I need to call an event which the event name was saved in a
    > variable.
    > Eg :
    > Dim sEventName as String
    > sEventName = "Button1_Click"
    >
    > Call sEventName
    >
    > 2) And how to load Form based on variable too?
    > Eg :
    > Dim sFormName as String
    > sFormName = "Form1"
    >
    > Load sFormName
    >
    > Hope someone can help me to solve the problems.
    >
    > Thanks a lot!
    >
    > Resant
    >




  3. #3
    Resant
    Guest

    Re: Call Event and Load Form based on Variable

    Wonderful!
    You save my time...
    Thanks a lot Tom


  4. #4
    Resant
    Guest

    Re: Call Event and Load Form based on Variable

    Tom,
    More question....
    Is there any coding that could tell what the last macro that have been
    run from other Workbook?

    Thanks,

    Resant


  5. #5
    Tom Ogilvy
    Guest

    Re: Call Event and Load Form based on Variable

    Not Unless you have the macro write that information someplace where you can
    access it; there is no built in support for it.

    --
    Regards,
    Tom Ogilvy

    "Resant" wrote:

    > Tom,
    > More question....
    > Is there any coding that could tell what the last macro that have been
    > run from other Workbook?
    >
    > Thanks,
    >
    > Resant
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1