[英]Word VBA Add Inlineshape Object to Table Cell
I'm creating a Word Document from MS Access VBA I want to add an Inlineshape Object to a Table Cell:我正在从 MS Access VBA 创建一个 Word 文档我想将一个 Inlineshape 对象添加到一个表格单元格中:
I create the Foto Object like that:我像这样创建了 Foto 对象:
Dim Foto As Inlineshape
Set Foto = WordObj.InlineShapes.AddPicture(FileName:="C:\Test.jpg")
then I create my table to insert it.然后我创建我的表来插入它。
Set tblNew = WordObj.Tables.Add(Range:=myRange, NumRows:=2, NumColumns:=1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitWindow)
How can I add the Foto object to a table cell?如何将 Foto 对象添加到表格单元格? I tried something like this
我试过这样的事情
tblNew.Cell(1, 1).Range = Foto
but it does not work但它不起作用
Try adding the table first, and then directly adding the Foto to that table by specifying the range on .AddPicture
:尝试先添加表格,然后通过在
.AddPicture
上指定范围直接将照片添加到该表格:
Set tblNew = WordObj.Tables.Add(Range:=myRange, NumRows:=2, NumColumns:=1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitWindow)
Dim Foto As Inlineshape
Set Foto = WordObj.InlineShapes.AddPicture(FileName:="C:\Test.jpg", Range:=tblNew.Cell(1, 1).Range)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.