Sub X6309X94AE5X0000P_X6309X94AE3X0000X8BDD_X6309X94AE3X0000X653E_X6309X94AE3X0000P_X6309X94AE1X0000X60C5_X6309X94AE1X0000X8BDD_X6309X94AE1X0000Y_OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y)
Dim objExcelApp
Dim bb,cc
bb=Now
'MsgBox CStr(bb)
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Visible = 1
objExcelApp.Workbooks.Open "E:\temp\ee\test.xls"
objExcelApp.Cells(1,1).Value = HMIRuntime.Tags("aa1").read
HMIRuntime.Screens("excel").ScreenItems("输入输出域1").OutpUTVALUe=objExcelApp.Cells(1,1).Value
cc = "E:\temp\ee\test-" + Mid(CStr(bb), 1, 3)+ Mid(CStr(bb), 4, 2)+ Mid(CStr(bb), 6, 2)+ Mid(CStr(bb), 8, 4)+ Mid(CStr(bb), 12, 4)+ Mid(CStr(bb), 16, 4) + Mid(CStr(bb), 18, 4)+ ".xls"
'MsgBox cc
objExcelApp.activeworkbook.save
objExcelApp.activeworkbook.Saveas cc
objExcelApp.Workbooks.Close
objExcelApp.Quit
End Sub
请问objExcelApp.activeworkbook.Saveas cc为什么不能另存为日期结尾的文件 ?谢谢!
最佳答案
Dim objExcelAPP,xlbook,xlsname
xlsname="D:\生产记录\报表.xls" ''''Excel文档路径
Set objExcelAPP=GetObject(,"Excel.Application") ''''获取当前运行的Excel应用程序对象
objExcelAPP.Visible=True
xlsname.SaveAs "D:\生产记录\" & Date & "_" & Hour(Now) & "_" & Minute(Now) & "_" & Second(Now) & ".xls"
提问者对于答案的评价:
用&,不用+;谢谢
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc263813.html