0
因此,我在上一個問題中找到了這個驚人的答案,我只是想知道如何在指定位置啓動搜索窗口 - 保存它們必須搜索儘管每次都有多個文件夾。對不起,我不能回覆原來的帖子,自從我創建了我的帳戶以來,我有1個聲望。從名稱不同的其他工作簿中獲取數據 - 要求用戶選擇它們
請幫忙! 謝謝,
顯式的選項
Sub Sample()
Dim wb1 As Workbook, wb2 As Workbook
Dim Ret1, Ret2
Set wb1 = ActiveWorkbook
'~~> Get the first File
Ret1 = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*", _
, "Please select first file")
If Ret1 = False Then Exit Sub
'~~> Get the 2nd File
Ret2 = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*", _
, "Please select Second file")
If Ret2 = False Then Exit Sub
Set wb2 = Workbooks.Open(Ret1)
wb2.Sheets(1).Cells.Copy wb1.Sheets(1).Cells
wb2.Close SaveChanges:=False
Set wb2 = Workbooks.Open(Ret2)
wb2.Sheets(1).Cells.Copy wb1.Sheets(2).Cells
wb2.Close SaveChanges:=False
Set wb2 = Nothing
Set wb1 = Nothing
End Sub
http://www.mrexcel.com/forum/excel-questions/574110-getopenfilename-default-directory.html – 2015-02-12 06:41:58