我正在编写一个子程序,我需要用户打开特定的工作簿,因为我需要将数据从将打开的工作簿复制到运行该子程序的工作簿。
由于将打开的文件是月度报告,因此用户很难始终将其以相同的文件名保存在同一位置。
因此,如果要求用户打开工作簿(月度报告),那就太好了。
Function openMontlyReport() as Workbook
MsgBox "Please select the monthly report in the next file dialog"
With Application.FileDialog(msoFileDialogOpen)
.Title = "Select Monthly Report"
.Filters.Add "Excel Files", "*.*"
.AllowMultiSelect = False
If .Show Then Set openMontlyReport = Application.Workbooks.Open .SelectedItems(1)
End With
End Function
现在您手头就有了用户刚刚打开的每月工作簿。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)