我使用以下宏来刷新4个工作簿中的所有数据链接,我的报告"报告"工作簿依赖于。我遇到的问题是数据没有准确更新,除非"启用宏"之前在用户计算机上的Q1-Q4工作簿中单击了按钮。
我尝试录制一个新宏,然后点击"启用宏"我打开它们时工作簿中的按钮但它没有记录。
从我在这里的论坛上看,我看到你不能强迫用户启用宏。还有其他我可以做的,或者在这里添加以使其有效吗?
(注意:目录和文件路径已更改为通用名称)
Sub Refresh_Quarterly()
'
' Refresh_Quarterly Macro
'
' Keyboard Shortcut: Ctrl+r
'
ChDir "Network Location 2018"
Workbooks.Open Filename:= _
"2018 Q1 Data Sheet.xlsm", UpdateLinks:=3
ActiveWorkbook.Save
ActiveWorkbook.Close
ChDir "Network Location 2018"
Workbooks.Open Filename:= _
"2018 Q2 Data Sheet.xlsm", UpdateLinks:=3
ActiveWorkbook.Save
ActiveWorkbook.Close
ChDir "Network Location 2018"
Workbooks.Open Filename:= _
"2018 Q3 Data Sheet.xlsm", UpdateLinks:=3
ActiveWorkbook.Save
ActiveWorkbook.Close
ChDir "Network Location 2018"
Workbooks.Open Filename:= _
"2018 Q4 Data Sheet.xlsm", UpdateLinks:=3
ActiveWorkbook.Save
ActiveWorkbook.Close
ThisWorkbook.RefreshAll
MsgBox "Thank you for refreshing all data linkages. 2018 Reports is now ready to use"
End Sub