Refresh from Access not working

K

klav

I have an excel spreadsheet (called "2009info") that is linked to an Access
database. Even though the connection properties specify that this should
refresh the data upon opening, it does not refresh unless I manually select
the refresh button.

I have a macro that I'm using to do various things with this spreadsheet and
several others so I used the following command in the macro to avoid having
to manually refresh it upon opening:

ActiveWorkbook.RefreshAll

This command works fine if I step through the macro but it does not work
when I generate the macro by simply running it. I don't get an error but it
does not do the refresh. Does anyone know why this would be happening and
what I can do to get around it?
 
F

FSt1

hi
try this instead....
Private Sub Workbook_Open()
Sheets("2009info").Range("A1").QueryTable.Refresh _
BackgroundQuery:=False
End Sub

regards
FSt1
 

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

Top