+ Reply to Thread
Results 1 to 3 of 3

calling procedures from worksheet buttons

  1. #1
    Anthony
    Guest

    calling procedures from worksheet buttons

    I have produced some code, which works perfectly and does exactly what I
    want. The code uses the Workbook_open function and the main calls to
    other procedures runs from there.

    The issue I have, is I need to trigger the workbook_open function from
    an on screen button and I just cant work out how to do this, as it is
    saying sub / function not defined even though I have set the
    Workbook_open function to public.

    any help appreciated

    Anthony Taylor

  2. #2
    Eddie
    Guest

    Re: calling procedures from worksheet buttons

    Cut out your Workbook_Open procedure into a Module. Call to the name of the
    Sub from your Workbook_Open function and from your commandButton function.




    "Anthony" <[email protected]> wrote in message
    news:[email protected]...
    >I have produced some code, which works perfectly and does exactly what I
    >want. The code uses the Workbook_open function and the main calls to other
    >procedures runs from there.
    >
    > The issue I have, is I need to trigger the workbook_open function from an
    > on screen button and I just cant work out how to do this, as it is saying
    > sub / function not defined even though I have set the Workbook_open
    > function to public.
    >
    > any help appreciated
    >
    > Anthony Taylor




  3. #3
    Norman Jones
    Guest

    Re: calling procedures from worksheet buttons

    Hi Anthony,

    In addition to Eddie's solution., as you have declared the Workbook_Open sub
    public, you can call it from a button by prefixing the sub name with the
    module name, e.g.:

    Private Sub CommandButton1_Click()
    Call ThisWorkbook.Workbook_Open
    End Sub

    ---
    Regards,
    Norman



    "Anthony" <[email protected]> wrote in message
    news:[email protected]...
    >I have produced some code, which works perfectly and does exactly what I
    >want. The code uses the Workbook_open function and the main calls to other
    >procedures runs from there.
    >
    > The issue I have, is I need to trigger the workbook_open function from an
    > on screen button and I just cant work out how to do this, as it is saying
    > sub / function not defined even though I have set the Workbook_open
    > function to public.
    >
    > any help appreciated
    >
    > Anthony Taylor




+ 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