Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to refresh from Access and then
I have a spreadsheet that is linked to an Access query. I am opening this
spreadsheet with a macro. In the macro, I am executing a refresh command and then I need to do some other things with the macro (such as opening other files and grabbing certain cells and putting them in a new spreadsheet). It seems that sometimes the macro continues without the refresh having completed. Is there a way to ensure the macro does not continue until the refresh has finished? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to refresh from Access and then
hi
you are allowing the query to refresh in the background. not recomended for reason you have already found out. would have been nice if you had posted your refresh code but here is the line i use to refresh Sheets("sheet1").range("A1").querytable.refresh backgroundquery:=false adjust the sheet and cell references to suit. you could also use.. sheets("sheet1").select range("A1").select selection.querytable.refresh Backgroundquery:=False but why???? either way will pause code execution untill the refresh is complete. Regards FSt1 "klav" wrote: I have a spreadsheet that is linked to an Access query. I am opening this spreadsheet with a macro. In the macro, I am executing a refresh command and then I need to do some other things with the macro (such as opening other files and grabbing certain cells and putting them in a new spreadsheet). It seems that sometimes the macro continues without the refresh having completed. Is there a way to ensure the macro does not continue until the refresh has finished? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to refresh from Access and then
Thank you for your help.
"FSt1" wrote: hi you are allowing the query to refresh in the background. not recomended for reason you have already found out. would have been nice if you had posted your refresh code but here is the line i use to refresh Sheets("sheet1").range("A1").querytable.refresh backgroundquery:=false adjust the sheet and cell references to suit. you could also use.. sheets("sheet1").select range("A1").select selection.querytable.refresh Backgroundquery:=False but why???? either way will pause code execution untill the refresh is complete. Regards FSt1 "klav" wrote: I have a spreadsheet that is linked to an Access query. I am opening this spreadsheet with a macro. In the macro, I am executing a refresh command and then I need to do some other things with the macro (such as opening other files and grabbing certain cells and putting them in a new spreadsheet). It seems that sometimes the macro continues without the refresh having completed. Is there a way to ensure the macro does not continue until the refresh has finished? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Refresh from Access not working | Excel Programming | |||
Macro to Refresh from Access | Excel Programming | |||
Refresh Data if Access File has Password | Excel Programming | |||
Timing of automatic query refresh and macro pivot table refresh | Excel Programming | |||
Web Query Logins and Access Refresh | Excel Programming |