我需要一個VBS格式化指定文件夾中的所有Excel文件。VBS格式化每個Excel文件
事實上,這個腳本將在不同的文件夾中每天運行。如果系統日期是2014/01/02,那麼它應該轉到名爲c:\ xxx \ 20140102的文件夾並在每個excel文件上運行。
我記錄在excel中的宏就是這樣;
Sub ACLDUZELT2()
'
' ACLDUZELT2 Macro
'
'
Rows("1:1").Select
Selection.AutoFilter
Selection.Font.Bold = True
Rows("1:4000").Select
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("A:CS").Select
Columns("A:CS").EntireColumn.AutoFit
Range("A1").Select
ActiveWorkbook.Save
End Sub
當然,文件必須保存像這樣的格式。
謝謝。
檢出FileSystemObject(Scripting Runtime Reference的一部分)以處理文件和文件夾。 https://support.microsoft.com/kb/186118 或者,您可以使用「Dir」 –