Command button to run macro in a module

  • Thread starter Thread starter DG
  • Start date Start date
D

DG

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 here:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top