我有一份excel文件,工人必须填写这些信息。之后我创建了一个宏,将文件保存在2个不同的文件夹中并打印出来。我的问题是文件的命名。如何命名文件,例如
QualityReportN,其中N是数字或确切的date_time(秒)
这是迄今为止的代码:
`Sub PrintSave()
'
' PrintSave Macro
'
' Print on default printer save
' Save in two place:
' 1.Specific folder on desktop (named quality cards)
' 2.Network server (location eg. \\HOMEGROUP\QualityCards\)
'
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Logical\Desktop\EXEL\QualityReprotN.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
ChDir "C:\Users\Logical\Desktop\New folder"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Logical\Desktop\Network\QualityReportN2.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
End Sub`
答案 0 :(得分:1)
您可以使用import UIKit
class Video {
var videoName: String
var videoTags: [String]
init(name: String, tags: [String]) {
self.videoName = name
self.videoTags = tags
}
}
var videos: [Video] = [Video(name: "First Video", tags: ["First", "Advice"]),Video(name: "Second Video", tags: ["Second", "Tutorial"]), Video(name: "Third Video", tags: ["Third", "Tutorial"])]
func filterVideos(tag: String)-> [Video] {
return videos.filter { (video) -> Bool in
for _tag in video.videoTags {
if _tag.lowercased().contains(tag.lowercased()) {
return true
}
}
return false
}
}
let filtered = filterVideos(tag: "Tuto") // <= this will contain Second Video And Third Video
功能
Now()
修改强>
查看VBA库以获取其他格式! Link
答案 1 :(得分:0)
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Logical\Desktop\Network\QualityReportN" & format(now(),"yyddmm_hhmmss") & ".xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False