I'm looking to add a line in my code that will halt the next code from executing in Access.
Following is my routine for a button that refreshes a web query in an Excel file. Instead of waiting until the line, xl.ActiveCell.QueryTable.Refresh completes, Access immediately goes to the next line executing the 'save as' operation. This in turn, prompts a message from Excel saying:
"This action will cancel a pending refresh data command. continue?"
Here's the full routine code:
***********************************************************
Private Sub btnUpdateExcelFile_Click()
Dim xl As Excel.Application
Set xl = New Excel.Application
xl.Workbooks.Open "C:testFile.xls"
xl.ActiveCell.QueryTable.Refresh <---- PAUSE HERE UNTIL COMPLETE.
xl.ActiveWorkbook.SaveAs FileName:="testfile_newUpdate.xls"
xl.Quit
Set xl = Nothing
End Sub
***********************************************************
Does anyone know what I need to add to halt Access?
Regards.
Following is my routine for a button that refreshes a web query in an Excel file. Instead of waiting until the line, xl.ActiveCell.QueryTable.Refresh completes, Access immediately goes to the next line executing the 'save as' operation. This in turn, prompts a message from Excel saying:
"This action will cancel a pending refresh data command. continue?"
Here's the full routine code:
***********************************************************
Private Sub btnUpdateExcelFile_Click()
Dim xl As Excel.Application
Set xl = New Excel.Application
xl.Workbooks.Open "C:testFile.xls"
xl.ActiveCell.QueryTable.Refresh <---- PAUSE HERE UNTIL COMPLETE.
xl.ActiveWorkbook.SaveAs FileName:="testfile_newUpdate.xls"
xl.Quit
Set xl = Nothing
End Sub
***********************************************************
Does anyone know what I need to add to halt Access?
Regards.