当我使用多个输入(参数化)运行测试时,我尝试生成带有时间戳的文件。
请建议我如何为文件名添加时间戳
例如:C:\xxx\xxxx\xxx\Responses\xxx.xlsx
到此路径我需要附加时间戳以使文件唯一。
答案 0 :(得分:0)
简易选项:
Dim sTimeStamp, sPath
sPath = "C:\Path\To\My\Folder\myFile.xlsx"
' Get current time and date value and strip out the separators
sTimeStamp = Replace(Replace(Replace(Now, " ", "_"), "/", ""), ":", "")
'insert timestamp into file name
sPath = Replace(sPath, ".xlsx", "_" & sTimeStamp & ".xlsx")
Debug.Write sPath ' output is C:\Path\To\My\Folder\myFile_20112017_015827.xlsx