macros以非标准格式select当前date文件夹中的文件

你能不能让我知道如何修改下面的代码,以便它自动打开它?

Range("A1:AK1").Select Range(Selection, Selection.End(xlDown)).Select Selection.ClearContents Range("A1").Select Workbooks.Open Filename:= _ "Y:\DentalConsumables\Company\DMC\DMC - Planning & Materials\Build Plan DTW Reports\DataWHSreports\2015-03-26_DWHS_PEN EU Fixed.xlsx" _ , UpdateLinks:=0, Notify:=False ActiveWindow.SmallScroll Down:=12 

如果只有date部分发生变化,您可以尝试一下:

编辑1:closures打开的文件

 Dim curDate As String, Fname As String curDate = Format(Date, "yyyy-mm-dd") ' returns the current date in specified format Dim wb As Workbook ' add a variable to pass your workbook object Fname = "Y:\DentalConsumables\Company\DMC\DMC - Planning & Materials\" _ & "Build Plan DTW Reports\DataWHSreports\" & curDate & "_DWHS_PEN EU Fixed.xlsx" Set wb = Workbooks.Open(FileName:=Fname, UpdateLinks:=False, Notify:=False) ' ~~> Other cool stuff goes here wb.Close False ' Close the opened workbook; False indicates to not save changes