Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help: Excel Macro window run button disabled for all code in 1 module? | Excel Programming | |||
Assigning a module to a button macro | Excel Discussion (Misc queries) | |||
command button for vba module | Excel Programming | |||
Adding module - assigning macro to button | Excel Programming | |||
Attaching a macro (module) code to button | Excel Programming |