Sub 你的程式()
Workbooks.Open Filename:=GetFileFullName
Windows("C:\B\A123.xlsx").Activate
Range("A1:AG1000").Select
Selection.Copy
'...
'...
'...
End Sub
Function GetFileFullName() As String
With Application.FileDialog(msoFileDialogFilePicker)
.Filters.Clear '先清除可選檔案清單
.Filters.Add "excel檔案", "*.xls;*.xlsx;*.xlsm" '限定選取檔案的清單
.InitialFileName = "C:\B" '選取視窗最初的資料夾位置
.AllowMultiSelect = False '不可多選
If .Show = 0 Then Exit Function '沒選擇就離開
GetFileFullName = .SelectedItems(1)
End With
End Function作者: ikboy 時間: 2020-7-16 12:18