我已经写了一个vba脚本,基本上将一张表插入到带有文本“单元格中的示例文本”的幻灯片中,现在我想将图像添加到单元格中该表取决于文件夹中表格的大小。使用宏将图像插入表格(vba powerpoint 2010)
基本上,如果它是5X3表,那么它应该从该文件夹中取出15张图像,并将其排列到带有图像文件名的单元格中。这是我想要的输出是这样的:
这是我写的代码是:
Sub NativeTable()
Dim pptSlide As Slide
Dim pptShape As Shape ' code to create table in present slide
Dim pptPres As presentation
Dim iRow As Integer
Dim iColumn As Integer
Dim oShapeInsideTable As Shape
Set pptPres = ActivePresentation
With pptPres
Set pptSlide = .Slides.Add(.Slides.Count, ppLayoutBlank)
End With
With pptSlide.Shapes
Set pptShape = .AddTable(NumRows:=3, NumColumns:=5, Left:=30, _
Top:=110, Width:=660, Height:=320)
End With
With pptShape.Table
For iRow = 1 To .Rows.Count
For iColumn = 1 To .Columns.Count
With .Cell(iRow, iColumn).Shape.TextFrame.TextRange
.Text = "Sample text in Cell"
With .Font
.Name = "Verdana"
.Size = "14"
End With
End With
Next iColumn
Next iRow
End With
End Sub
所以,我怎么能做到这一点,请帮助我这个和图像应可调整大小(如这是可能的)请帮我这 这是可能的我检查了msdn对象的引用,但没有选择在单元格中插入图片