#include <Excel.au3>
; 启动Excel应用程序
Local $oExcel = _Excel_Open()
If @error Then
MsgBox(0, "Error", "Failed to start Excel.")
Exit
EndIf
; 打开工作簿
Local $oWorkbook = _Excel_BookOpen($oExcel, "路径\你的工作簿.xlsx")
If @error Then
MsgBox(0, "Error", "Failed to open workbook.")
_Excel_Close($oExcel)
Exit
EndIf
; 激活工作表
_Excel_SheetActivate($oWorkbook, "Sheet1")
; 设置单元格内容和格式
_Excel_RangeWrite($oWorkbook, Default, "2024年4月明细[4月30日]", "A1")
_Excel_RangeFont($oWorkbook, Default, "A1", "宋体", 16, True, False, False, False, 0)
_Excel_RangeWrite($oWorkbook, Default, "其他文本", "A1", Default, Default, Default, 14)
_Excel_RangeFont($oWorkbook, Default, "A1", "宋体", 9, True, False, False, False, 0, Default, 14)
; 关闭工作簿并退出Excel应用程序
_Excel_BookClose($oWorkbook)
_Excel_Close($oExcel)
你试下,无测试过 |