B
bobh
Hi All,
I have this vba code in an Access2003 application and the line
.ActiveWorkbook.RefreshAll
does not work 100% of the time and I don't know why. Everything else
works cell A3 gets updated and the workbook gets saved in it's proper
place. Each workbook has a query in this Access db that is the
workbooks data source. If I open each workbook and do a 'RefreshAll'
it works every time without any problems. Defeats automation if I
have
to open each workbook(currently there are 35 different workbooks in
this loop) and check it be sure that the data did refresh.
So, any ideas or insights as to why the 'RefreshAll' when sent from
Access vba does/would not work 100% of the time.......
I know this is Access vba and I have posted this in the Access forum
But I'm looking for any ideas or insight from an Excel perspective as
to why the Excel workbook would not refresh.
Do Until MyRec.EOF
With objExcel
.Visible = False
.DisplayAlerts = False
.Workbooks.Open strOPathNme & strOFileNme
.Range("A3").Select
.ActiveCell.FormulaR1C1 = strLongNmeDte & ", " &
Left(Me.bxMthFor, 4)
.ActiveWorkbook.RefreshAll
.ActiveWorkbook.SaveAs FileName:=strSPathNme & strSFileNme
.ActiveWorkbook.Close savechanges:=False 'this is the
template
file so don't save the changes
.Workbooks.Close
DoEvents
End With
MyRec.MoveNext
I have this vba code in an Access2003 application and the line
.ActiveWorkbook.RefreshAll
does not work 100% of the time and I don't know why. Everything else
works cell A3 gets updated and the workbook gets saved in it's proper
place. Each workbook has a query in this Access db that is the
workbooks data source. If I open each workbook and do a 'RefreshAll'
it works every time without any problems. Defeats automation if I
have
to open each workbook(currently there are 35 different workbooks in
this loop) and check it be sure that the data did refresh.
So, any ideas or insights as to why the 'RefreshAll' when sent from
Access vba does/would not work 100% of the time.......
I know this is Access vba and I have posted this in the Access forum
But I'm looking for any ideas or insight from an Excel perspective as
to why the Excel workbook would not refresh.
Do Until MyRec.EOF
With objExcel
.Visible = False
.DisplayAlerts = False
.Workbooks.Open strOPathNme & strOFileNme
.Range("A3").Select
.ActiveCell.FormulaR1C1 = strLongNmeDte & ", " &
Left(Me.bxMthFor, 4)
.ActiveWorkbook.RefreshAll
.ActiveWorkbook.SaveAs FileName:=strSPathNme & strSFileNme
.ActiveWorkbook.Close savechanges:=False 'this is the
template
file so don't save the changes
.Workbooks.Close
DoEvents
End With
MyRec.MoveNext