我创建了一个宏按钮来从 excel 生产表中打开我的日常文件,其中我有特定文件的所有宏按钮。
我所有文件的格式通常是相同的:
- 业务单位名称:基督教青年会
- 年份:2012
- 月份:四月
- 周:第 2 周
- 天数:12
- 文件名称:YMC模板041212.xlsm
我遇到了最后一个 excel 文件扩展名的问题。如何添加 MyDaily 模板和 MyDateProd 以及 .xlsm。我有这个 -J:.....\& myDailyTemplate & myDateProd.xlsm") 请参阅下面的完整文件路径名。
Sub Open_DailyProd()
Dim myFolderYear As String
Dim myFolderMonth As String
Dim myFolderWeek As String
Dim myFolderDaily As String
Dim myDateProd As String
Dim myBusinessUnit As String
Dim myDailyTemplate As String
myBusinessUnit = Sheet1.Cells(32, 2)
myFolderYear = Sheet1.Cells(11, 2)
myFolderMonth = Sheet1.Cells(12, 2)
myFolderWeek = Sheet1.Cells(13, 2)
myFolderDaily = Sheet1.Cells(14, 2)
myDateProd = Sheet1.Cells(15, 2)
myDailyTemplate = Sheet1.Cells(6, 5)
Application.Workbooks.Open ("J:\IAS\3CMC05HA01\IAC Clients\myBusinessUnit\myFolderYear\myFolderMonth\myFolderWeek\myFolderDaily\& myDailyTemplate & myDateProd.xlsm")
End Sub