excel - 如果文件已存在,则覆盖该文件
问题描述
如果文件已经存在,需要覆盖。在以下代码行中使用 Adobe api 将 pdf 转换为 excel。但是,如果文件已存在于某个位置(boresult 命令),则需要覆盖该文件
Dim objAcroApp As Acrobat.AcroApp
Dim objAcroAVDoc As Acrobat.AcroAVDoc
Dim objAcroPDDoc As Acrobat.AcroPDDoc
Dim objJSO As Object
Dim boResult As Boolean
Dim ExportFormat As String
Dim NewFilePath As String
'Initialize Acrobat by creating App object.
Set objAcroApp = CreateObject("AcroExch.App")
'Set AVDoc object.
Set objAcroAVDoc = CreateObject("AcroExch.AVDoc")
'Set the PDDoc object.
Set objAcroPDDoc = objAcroAVDoc.GetPDDoc
'Set the JS Object - Java Script Object.
Set objJSO = objAcroPDDoc.GetJSObject
'some code to define newfilepath format function; confidential so not
sharing
'Save PDF file to the new format.
boResult = objJSO.SaveAs(NewFilePath, ExportFormat)
'need boResult to overwrite if file already exists.
解决方案
推荐阅读
- javascript - Vue v-if 语句检查变量是否为空或 null
- sql - 如何制定需要提及四个不同表的 SQL 查询?
- spring-kafka - KafkaListenerContainerFactory 未正确创建
- python - 将 SQL 查询类型转换为 Python 类型
- javascript - 编写导出函数的更好方法是什么?
- oracle - 以 WE8MSWIN1252 字符集和 AL16UTF16 NCHAR 字符集完成导入,但没有任何反应?
- javascript - 如何检测 Web 组件集或更改的数据属性
- encryption - .net core web api中的AES-GCM是否依赖机器密钥?
- python - Python - 遍历列表和字典以获取嵌套列表输出
- javascript - 正则表达式:匹配上下文中的特定字符