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