ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calling procedures from worksheet buttons (https://www.excelbanter.com/excel-programming/335314-calling-procedures-worksheet-buttons.html)

Anthony[_6_]

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

Eddie[_7_]

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" wrote in message
...
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




Norman Jones

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" wrote in message
...
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





All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com