excel - 如何通过 VBA 和 AVDoc 在 Excel 中编辑嵌入的 PDF?
问题描述
我想使用 VBA 编辑作为对象附加到我的 Excel 文档的 pdf 文件。
背景:由于我不想以 .zip 或其他方式共享这两个文件,并且没有每个人都有权访问的网络驱动器,因此我需要一个“万无一失”的解决方案。
pdf 文件包含一个表格(强制性),并将填写此 Excel 文档中的信息。如前所述,我已经有了将 pdf 文件存储在网络驱动器上的解决方案。
Dim file, new_name As String
Set AcroApp = CreateObject("AcroExch.App")
Set AvDoc = CreateObject("AcroExch.AVDoc")
'Open new PDF file
'Use local path
file = "C:\Users\992\Desktop\example.pdf"
new_name = "New_PDF_12092019"
If AvDoc.Open(Datei, Name) Then
AcroApp.Show
Set PDDoc = AvDoc.GetPDDoc()
Set jso = PDDoc.GetJSObject
'Get cart ID
jso.getField("Feld1").Value = CStr(ActiveSheet.Range("B12").Value)
'Get Project ID
jso.getField("Feld2").Value = CStr(ActiveSheet.Range("B14").Value)
...
我的问题是:有没有可能使用嵌入式对象 AcroExch.AVDoc
?
由于参数szFullPath
需要打开文件的完整路径,我考虑获取对象的“路径”并使用它 - 但我不知道如何。已经尝试过了:https ://danny.fyi/embedding-and-accessing-a-file-in-excel-with-vba-and-ole-objects-4d4e7863cfff
也许有人可以帮助我。提前致谢!
解决方案
推荐阅读
- sql-server - SQL Server 2016 中的慢查询
- angular - ngbPopover 与从函数返回的 html
- amazon-web-services - TFLite 对象检测模型的 Sagemaker Neo 编译失败
- javascript - 使用最新时间戳和 EmailID 过滤 DynamoDB 表中的值
- javascript - 如何验证 2 个 JavaScript 对象是否具有相同的键
- java - 如何在每次绘制到 UI 之前获取 ImageView 的高度和宽度(在片段中)
- css - 离子自定义按钮动画在所有按钮上触发
- javascript - Rails 6 看不到 JS
- java - 如何使用 JNI 在 Java 中调用 c++ 应用程序
- teradata - 如何从字符串中取出一个数字并将其加 1