如果有其他方式 调度 </跨度> 使用Jenkins的Excel宏。 vbs文件代码是这样的:
选项明确
On Error Resume Next
ExcelMacroExample
Sub ExcelMacroExample()
昏暗的xlApp 朦胧的
找到了解决方案。
用内容写一个powershell文件 - :
**
$macroBook = ".\Excel.xlsm" $procedureName = "Macro" $macroBookFullPath = (ls $macroBook).FullName $macroProcName = (ls $macroBook).Name + "!" + $procedureName $excelApp = New-Object -com "Excel.Application" try { $excelApp.DisplayAlerts = $false $excelApp.Workbooks.Open($macroBookFullPath) $excelApp.Run($macroProcName) } finally { $excelApp.DisplayAlerts = $false $excelApp.Quit() }
你需要Jenkins的powershell插件。按照步骤 1.添加构建步骤“Windows Powershell” 2.编写此命令 - “mkdir C:\ Windows \ system32 \ config \ systemprofile \ Desktop” 3.使用“./”作为powershell步骤(“./Powershell_Test.ps1”)执行powershell文件(.ps1) 然后你快乐的方式。
这听起来像是一个许可问题。我不知道'詹金斯'是什么,但我认为你应该确保它拥有管理员权限。