+ Reply to Thread
Results 1 to 7 of 7

Execute Macros through Hyperlinks.

  1. #1
    saddat@gmail.com
    Guest

    Execute Macros through Hyperlinks.

    could anybody help my in this regard? I need to execute Macros by using
    simple text links (hyperlinks). I can run macros through images or form
    objects, but now the problem is bit different. I dont even have an idea
    how to run macros through hyperlinks. please guys help me out in this
    regard, it is very urgent for me. thanks and regards,

    Saddat Sarfraz
    (Saadi)


  2. #2
    Tim Williams
    Guest

    Re: Execute Macros through Hyperlinks.

    Create hyperlinks which just point to the same cell the hyperlink is in.
    Handle the sheet's FollowHyperlink event to dtermine which link was clicked.

    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

    Select Case Target.Address 'or some other property
    Case "D8": MsgBox "call a macro"
    Case "D9": MsgBox "call a different macro"
    End Select

    End Sub

    ....replace the Msgbox with calls to the appropriate macro.

    Tim


    --
    Tim Williams
    Palo Alto, CA


    <saddat@gmail.com> wrote in message
    news:1137526736.003683.141840@o13g2000cwo.googlegroups.com...
    > could anybody help my in this regard? I need to execute Macros by using
    > simple text links (hyperlinks). I can run macros through images or form
    > objects, but now the problem is bit different. I dont even have an idea
    > how to run macros through hyperlinks. please guys help me out in this
    > regard, it is very urgent for me. thanks and regards,
    >
    > Saddat Sarfraz
    > (Saadi)
    >




  3. #3
    saddat@gmail.com
    Guest

    Re: Execute Macros through Hyperlinks.

    thanks Tim for your reply,

    could you also help me out and tell me how do I call the Macro. may I
    just need to wrtie the name of the macro in place of MsgBox function.

    thanks,

    Saddat Sarfraz
    (Saadi)


  4. #4
    Tim Williams
    Guest

    Re: Execute Macros through Hyperlinks.

    >may I just need to wrtie the name of the macro in place of MsgBox function.
    Yes - that's all you need to do
    ....
    Case "whatever": MacroName
    ....

    Tim
    --
    Tim Williams
    Palo Alto, CA


    <saddat@gmail.com> wrote in message
    news:1137536320.917647.44220@g43g2000cwa.googlegroups.com...
    > thanks Tim for your reply,
    >
    > could you also help me out and tell me how do I call the Macro. >
    > thanks,
    >
    > Saddat Sarfraz
    > (Saadi)
    >




  5. #5
    saddat@gmail.com
    Guest

    Re: Execute Macros through Hyperlinks.

    Sorry to trouble you again.

    I am trying to run the command but nothing is happaning. I tried with
    Macro as well as MsgBox Function, nothing is working.


  6. #6
    Tim Williams
    Guest

    Re: Execute Macros through Hyperlinks.

    Show the exact code which is not working.
    What does it do instead of working?

    tim

    --
    Tim Williams
    Palo Alto, CA


    <saddat@gmail.com> wrote in message
    news:1137537988.806480.147830@g43g2000cwa.googlegroups.com...
    > Sorry to trouble you again.
    >
    > I am trying to run the command but nothing is happaning. I tried with
    > Macro as well as MsgBox Function, nothing is working.
    >




  7. #7
    Toppers
    Guest

    Re: Execute Macros through Hyperlinks.

    Hi,
    This worked:

    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

    Select Case ActiveCell.Address

    Case "$D$8": MyMacro
    Case "$D$9": MsgBox "call a different macro"

    End Select

    End Sub

    Sub MyMacro()
    MsgBox "MyMacro called"
    End Sub


    HTH

    "saddat@gmail.com" wrote:

    > Sorry to trouble you again.
    >
    > I am trying to run the command but nothing is happaning. I tried with
    > Macro as well as MsgBox Function, nothing is working.
    >
    >


+ 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