Autohotkey 保存 excel 文件而没有看到覆盖提示
Autohotkey save excel file without seeing overwrite prompt
我有一个自动热键脚本,可以将文件保存到共享点中的备份位置。我可以将文件保存在那里,但它一直要求可以覆盖提示,我想知道是否有可能摆脱它。
代码如下。
ExcelRefresh(File) { ; Function
sharepointPath := "\sharepoint\Location\SharepointCompleted.xlsx"
oExcel := ComObjCreate("Excel.Application")
oExcel.Visible := false
oWorkbook := oExcel.Workbooks.Open(File)
oWorkbook.RefreshAll
oWorkbook.Save()
oExcel.ActiveWorkbook.SaveAs(sharepointPath)
oWorkbook.Close(false)
oExcel.Quit()
}
我最后所做的只是简单地检查文件是否存在,如果文件存在,我会在将文件保存到 SharePoint 的备份位置之前将其删除。不是清洁方式,但它有效。
IfExist , \sharepoint\sites\SharepointCompleted.xlsx
;MsgBox, it esxists
FileDelete, \sharepoint\sites\SharepointCompleted.xlsx
Sleep 15000
我在 运行 函数之前添加了这个。到目前为止它已经通过了我的测试。
我有一个自动热键脚本,可以将文件保存到共享点中的备份位置。我可以将文件保存在那里,但它一直要求可以覆盖提示,我想知道是否有可能摆脱它。
代码如下。
ExcelRefresh(File) { ; Function
sharepointPath := "\sharepoint\Location\SharepointCompleted.xlsx"
oExcel := ComObjCreate("Excel.Application")
oExcel.Visible := false
oWorkbook := oExcel.Workbooks.Open(File)
oWorkbook.RefreshAll
oWorkbook.Save()
oExcel.ActiveWorkbook.SaveAs(sharepointPath)
oWorkbook.Close(false)
oExcel.Quit()
}
我最后所做的只是简单地检查文件是否存在,如果文件存在,我会在将文件保存到 SharePoint 的备份位置之前将其删除。不是清洁方式,但它有效。
IfExist , \sharepoint\sites\SharepointCompleted.xlsx
;MsgBox, it esxists
FileDelete, \sharepoint\sites\SharepointCompleted.xlsx
Sleep 15000
我在 运行 函数之前添加了这个。到目前为止它已经通过了我的测试。