当我尝试在特定路径中的工作簿中选择数据时,我收到错误9。
这是我的代码:
myPath = "Z:\7. Personnel\Florian\Projet_BDC\Test\"
myPath2 = "Z:\7. Personnel\Florian\Projet_BDC\Test\Consolidations\"
Set sht = Workbooks("Consolidation.xlsm").Worksheets(2)
Set wbconso_dest = Workbooks.Add
wbconso_dest.SaveAs Filename:=myPath2 & "Consolidation." & Dateconso & ".xlsx"
Workbooks(myPath & "Consolidation.xlsm").Activate
sht.Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy Destination:=wbconso_dest.Worksheets(1)
wbconso.Close
在这一行我收到错误:
Workbooks(myPath & "Consolidation.xlsm").Activate