vba - 如何使用vba在includepicture字段中发送图像路径
问题描述
我有一个具有表单的访问数据库。此表单中有一个提交按钮。当我单击此按钮时,我正在运行一些 vba 代码。如果所有代码都运行成功,我将创建带有 docvariables 的 ms word 文档。所以我想在 includepicture 字段中发送图像路径,为此我写了这段代码
{INCLUDEPICTURE {DOCVARIABLE PICTURE}\* MERGEFORMAT}
我在我的word文档中使用了上面的代码。这些是我的 vba 代码,我在我的访问数据库表中获取图像路径。
Dim imgPath As String
Dim imgName As String
Dim imgPath_rp As String
Dim db_image As DAO.Database
Dim rs_image As DAO.Recordset
Set db_image = OpenDatabase("C:\Users\ftk1187\Desktop\Test WS_11-Jun-2018 - Copy.mdb", False, False, "")
Set rs_image = db_image.OpenRecordset("SELECT * FROM TableSıgnature WHERE ImageName = '" & Me.Combo474.Value & "'", dbOpenDynaset)
If Me.Combo474.Value = rs_image!ImageName Then
imgPath = rs_image!imagePath
End If
imgPath_rp = Replace(imgPath, "\", "\\")
rs_image.Close
Set rs_image = Nothing
db_image.Close
objDOC.Variables("PICTURE").Value = imgPath_rp
当我单击提交按钮时,它没有给我任何错误,但图像无法显示。
解决方案
推荐阅读
- google-chrome - 如何停用 Chrome 的相似警告
- excel - VBA 用户窗体:获取 xlFileFormat 作为输入
- apache-spark - 使用分区模式进行 Spark 加载
- python - 来自 BeautifulSoup 结果的正则表达式不匹配模式
- java - 如何使用 Log4J 2.X 在文件中写入特定的记录器?(在 JAVA 中编程)
- java - 在 docker 中为 playwright 添加一个测试运行器
- .net - 正则表达式与数字之间的连字符和固定的整个长度
- c# - AutoFixture 中对延迟实例化的专门延迟支持
- ios - 如何在 ios 版本 14.7.1 中获得相机权限?
- java - 单个 Spring 应用程序可以在两个 kafka 集群上推送/生成消息吗?