我是一名自由职业的Java程序员,第一次被要求在PowerPoint上进行一些VBA编程,我有点挣扎。
我已经创建了一个按钮,该按钮会触发幻灯片的创建(这是可行的)。在此新幻灯片上,我想创建一个ActiveX文本框(在“演示”模式下可以使用的文本框之一),但是我只能创建“标准” PowerPoint文本框。
我确信这是一个非常简单的命令,但是我在任何地方都找不到。.
这是我正在使用的代码。有人可以帮我吗?谢谢!
Public Sub addContentToSatelliteSlide()
currentSlide = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
'CURRENT SLIDE ON SLIDESHOW
With ActivePresentation.Slides(currentSlide + 1).Shapes
With .AddTextbox(msoTextOrientationHorizontal, 160, 80, 400, 400).TextFrame
.TextRange.Text = "add informatiom here"
.TextRange.Paragraphs.ParagraphFormat.Alignment = ppAlignLeft
.TextRange.Font.Color = RGB(255, 255, 255)
.TextRange.Font.Size = 11
.TextRange.Font.Name = "Arial"
.TextRange.Font.Bold = False
.TextRange.Font.Color = RGB(0, 0, 0) 'BLACK
End With
End With
End Sub
一个ActiveX文本框是一个OLE控件,所以请改用以下语法:
.AddOLEObject Left:=160, Top:=80, Width:=400, Height:=400, ClassName:="Forms.TextBox.1"
这里是Microsoft的帮助页面:Shapes.AddOLEObject method (PowerPoint)