![]() |
Command button to run macro in a module
My spreadsheet has an ODBC query in it that pulls data from an SQL database.
This has been placed in a macro named Refresh_Query() in Module1. I put a command button from the Control Toolbox and named it RefreshButton. Then double clicked the button to go into VB editor and in Shee1(Sheet1) it has a Private Sub RefreshButton_Click(). I put Refresh_Query() in he Private Sub RefreshButton_Click() Refresh_Query() End Sub When I hit enter after typing Refresh_Query() I get an error: "Compile error: Expected: =". What does this mean? I know I've done this before. Do I need to declare something as global? Dan |
Command button to run macro in a module
Never mind, I found it.
Did not need the (). "DG" wrote in message ... My spreadsheet has an ODBC query in it that pulls data from an SQL database. This has been placed in a macro named Refresh_Query() in Module1. I put a command button from the Control Toolbox and named it RefreshButton. Then double clicked the button to go into VB editor and in Shee1(Sheet1) it has a Private Sub RefreshButton_Click(). I put Refresh_Query() in he Private Sub RefreshButton_Click() Refresh_Query() End Sub When I hit enter after typing Refresh_Query() I get an error: "Compile error: Expected: =". What does this mean? I know I've done this before. Do I need to declare something as global? Dan |
Command button to run macro in a module
DG
Remove the () after Refresh_Query Gord Dibben MS Excel MVP On Wed, 21 Mar 2007 16:28:22 -0400, "DG" wrote: My spreadsheet has an ODBC query in it that pulls data from an SQL database. This has been placed in a macro named Refresh_Query() in Module1. I put a command button from the Control Toolbox and named it RefreshButton. Then double clicked the button to go into VB editor and in Shee1(Sheet1) it has a Private Sub RefreshButton_Click(). I put Refresh_Query() in he Private Sub RefreshButton_Click() Refresh_Query() End Sub When I hit enter after typing Refresh_Query() I get an error: "Compile error: Expected: =". What does this mean? I know I've done this before. Do I need to declare something as global? Dan |
All times are GMT +1. The time now is 01:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com