为了将日期放在我创建的工作簿中,我使用了这段代码。
Dim tarih As String
Dim dot As String
dot = "."
Dim days2 As Integer
Dim months2 As Integer
Dim years2 As Integer
days2 = Day(Date)
months2 = Month(Date)
years2 = Year(Date)
tarih = days2 & dot & months2 & dot & years2
Workbooks.Add
ActiveWorkbook.SaveAs "C:\Users\" & Environ$("USERNAME") & "\Desktop\Excel Before Code Templates (BCT)\ROL_Analysis" & tarih & ".xlsx"
Application.WindowState = xlMinimized
Dim strii As String
strii = "ROL_Analysis" & tarih & ".xlsx"
Workbooks("ROL_Analysis" & tarih & ".xlsx").Activate
我直接使用了这个名字,之后我定义了一个字符串来放置它,但它不起作用。有什么想法吗?
答案 0 :(得分:0)
Workbooks.Add
Dim strii As String
strii = "ROL_Analysis" & tarih & ".xlsx"
ActiveWorkbook.SaveAs "C:\Users\" & Environ$("USERNAME") & "\Desktop\Excel Before Code Templates (BCT)\" & strii & ""
Application.WindowState = xlMinimized
Workbooks(strii).Activate
确定无误