0
我正在使用以下代碼從Access應用程序中刷新Excel數據透視表。刷新樞紐後,保存和關閉Excel應用程序的最佳方法是什麼?在我的最後一次嘗試中,代碼在樞紐刷新之前試圖保存並關閉。Excel數據透視刷新,保存並在Access VBA代碼中關閉
Private Sub Command161_Click()
Dim objXL As Object, x
On Error Resume Next
Set objXL = CreateObject("Excel.Application")
With objXL.Application
.Visible = True
'Open the Workbook
.Workbooks.Open "myfilepath.xls"
'Refresh Pivots
x = .ActiveWorkbook.RefreshAll
End With
Set objXL = Nothing
End Sub