转换文件名的date

我无法将date转换为将保存Excel文档的格式。 即取出“/”和/或用“ – ”replace它们

Dim strDate Dim intLen Dim test Dim testArray strDate = Date test = CStr(strDate) testArray = Split(test) intLen = Len(test) For i = 0 To intLen if testArray(i) = "/" Then testArray(i) = "-" End If Next 'Replace test, "/", "_" For i = 0 To 3 Wscript.Echo testArray(i) Next objExcel.ActiveWorkBook.SaveAs "C:\Inventory Script" & intLen & ".xls" objExcel.Close objExcel.Quit 

我试过replace,因为它似乎是明显的答案,但它什么都不做。 起初我虽然是因为它不是一个stringtypes,但它仍然没有任何东西。

然后,我尝试通过迭代string作为数组并手动replace,但没有做任何事情,做旧学校。

目前没有错误产生,Wscript.Echo testArray(i)正在输出11/17/2015对我来说完全是输出。

 Dim strDate Dim intLen Dim test Dim testArray strDate = Date test = CStr(strDate) '''''' test= join(Split(test,"/"),"_") '''''' test= join(Split(test,"-"),"_") test= replace(test,"/","_") test= replace(test,"-","_") Wscript.echo test