基本上我想知道如何使用 VBScript 为单元格设置居中对齐...
我一直在谷歌上搜索它,但似乎找不到任何有用的东西。
最佳答案
Set excel = CreateObject("Excel.Application")
excel.Workbooks.Add() ' create blank workbook
Set workbook = excel.Workbooks(1)
' set A1 to be centered.
workbook.Sheets(1).Cells(1,1).HorizontalAlignment = -4108 ' xlCenter constant.
workbook.SaveAs("C:\NewFile.xls")
excel.Quit()
set excel = nothing
'If the script errors, it'll give you an orphaned excel process, so be warned.
将其另存为 .vbs 并使用命令提示符或双击运行它。
关于VBScript Excel 格式化 .xlsx 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/142110/