在VBA中为Powerpoint Application移动文本框的位置 [英] Move position of a textbox within VBA for Powerpoint Application
问题描述
我正在尝试将文本框粘贴到幻灯片中,该幻灯片有效但将其放在幻灯片的中间(位置明智)。我想改变位置,以便将其移动到我想要的位置。我怎么做?谢谢
I am attempting to paste a textbox in a slide which works but puts it in the middle of the slide (position wise). I want to alter the position so I can move it to the location I want. How do I do that? Thanks
Set ppApp = CreateObject("Powerpoint.application")
Range("C1").Select
Selection.Copy
ppApp.ActiveWindow.View.Paste
推荐答案
此代码创建一个新的ppt添加excel范围("c1")的内容并将位置设置为.top = 1和.left = 1(演示文稿的左上角)
this code creates a new ppt add the content of excel range("c1") and set positions to .top=1 and .left=1 ( left top corner of the presentation)
Sub helpforppt()
Dim pp作为PowerPoint.Application
  Dim PPPres As PowerPoint.Presentation
范围("C1")。选择
Selection.Copy
设置pp =新PowerPoint.Application
 设置PPPres = pp.Presentations.Add
  pp.Visible = True
 设置PPPres = pp.ActivePresentation
 设置PPSlide = PPPres.Slides.Add(Slidecount + 1,ppLayoutText)
pp.ActivePresentation.Slides(1).Shapes.Paste
pp.ActivePresentation.Slides(1 )。形状(3)。顶部= 1
pp.ActivePresentation.Slides(1)。形状(3).Left = 1
结束子
Sub helpforppt()
Dim pp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Range("C1").Select
Selection.Copy
Set pp = New PowerPoint.Application
Set PPPres = pp.Presentations.Add
pp.Visible = True
Set PPPres = pp.ActivePresentation
Set PPSlide = PPPres.Slides.Add(Slidecount + 1, ppLayoutText)
pp.ActivePresentation.Slides(1).Shapes.Paste
pp.ActivePresentation.Slides(1).Shapes(3).Top = 1
pp.ActivePresentation.Slides(1).Shapes(3).Left = 1
End Sub
这篇关于在VBA中为Powerpoint Application移动文本框的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!