Home > Software engineering > The purpose of the VBS used by CopyFile adding variable path problem
The purpose of the VBS used by CopyFile adding variable path problem
Time:12-22
This is a VBS according to excel template, copy to generate a new excel, and named after the time when the copy to the new generation of excel program, the following
Option Explicit The Function action Dim fso, myfile daystr, DSTR, fname DSTR=FormatDateTime (Date) DSTR fname="d: " + + ". XLS " The Set of fso=CreateObject (" scripting. FileSystemObject ") The Set MyFile=fso. GetFile (" d: \ ExcelExample. XLS ") MyFile. Copy (fname) End the Function
Always does not perform this sentence MyFile. Copy (fname) address format is wrong, it is a great god
CodePudding user response:
You check the fname,/symbol will appear here, in the file is not allowed, so fail, To try this: DSTR=format $(date, "yyyy - mm - dd)"