简体   繁体   English

使用输入框将一个 PowerPoint 演示文稿的图形复制并粘贴到另一个 PowerPoint 演示文稿

[英]Copy and paste graph of one PowerPoint presentation to another PowerPoint presentation with inputbox

Hello:) what I want to do is to have a Master document (PowerPoint) to use as template and personalize with graphics that are in another PowerPoint presentation.你好:) 我想做的是有一个主文档 (PowerPoint) 用作模板并使用另一个 PowerPoint 演示文稿中的图形进行个性化。 The master document on the code is "pre".代码上的主文档是“pre”。 The PowerPoint with the graphics is "graphs_pre".带有图形的 PowerPoint 是“graphs_pre”。 The idea is to click in a image on a slide of "pre" and a input box appears asking "Please enter the name of the graph", we write the name of the graph, the code opens the "graphs_pre" search for the graph with the same name and copy and paste on the "pre".思路是在“pre”的幻灯片上点击图片,出现一个输入框询问“请输入图的名称”,我们写下图的名称,代码打开“graphs_pre”搜索图具有相同的名称并复制并粘贴在“pre”上。 This isn't working, always giving a lot of errors.这不起作用,总是给出很多错误。 So I need your help please.所以我需要你的帮助。 Please bare in mind that I have zero experience in coding...请记住,我在编码方面的经验为零......

Code:代码:

Sub test() 

Dim vSlide As Slide

Dim vSlide As Slides

Dim vShape As Shape

Dim vShapes As Shapes
Dim pre As Presentation 

Dim graphs_pre As Presentation

Set pre = ActivePresentation

Set graphs_pre = Presentations.Open ("path of the graph presentation", msoFalse) 

strResult = InputBox ("Please enter the name of the graph") 

Set vShapes = Presentations(Dir("path of graph presentation").Slides.Shapes

For each vShape in vShapes 
If strResult = vShape.Name Then

vShape.Copy

pre.Slides.Paste

End If 

Next vShape
 
End Sub

Let's see if this (air code) gets you a little closer:让我们看看这个(空气代码)是否能让你更接近一点:

Sub test() 

Dim vSlide As Slide

'Dim vSlide As Slides
Dim vSlides as Slides

Dim vShape As Shape

Dim vShapes As Shapes
Dim pre As Presentation 

Dim graphs_pre As Presentation
' You use this later w/o DIMming it so add this
Dim strResult as String

Set pre = ActivePresentation

Set graphs_pre = Presentations.Open ("path of the graph presentation", msoFalse) 

strResult = InputBox ("Please enter the name of the graph") 

' I don't understand what this is supposed to do
' Set vShapes = Presentations(Dir("path of graph presentation").Slides.Shapes
' but I THINK you need to do this:
For each vSlide in graphs_pre.Slides
For each vShape in vSlide.Shapes
If strResult = vShape.Name Then
vShape.Copy

' This will paste onto the first slide in pre for now
' Which slide do you really WANT it on?
pre.Slides(1)Shapes.Paste

End If 

Next ' vShape
Next ' vSlide
 
End Sub

And once you're all done, you'll want to do graphs_pre.Close一旦你完成了,你会想要做 graphs_pre.Close

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将特殊符号从一个PowerPoint演示文稿复制到另一个 - Copy Special Symbols From One PowerPoint Presentation to Another 将Excel工作表粘贴到PowerPoint演示文稿中 - Paste Excel worksheet to a PowerPoint presentation 在另一个 Powerpoint 演示文稿中嵌入来自其他 Powerpoint 演示文稿的幻灯片的链接副本 - Embed a linked copy of a slide from other Powerpoint presentation in another Powerpoint presentation 如何将多个 Excel 图表粘贴到 PowerPoint 演示文稿中? - How to paste multiple Excel charts into a PowerPoint presentation? 如何在 VBA 中将形状从一个 Powerpoint 演示文稿复制到另一个? - How do I copy a Shape from one Powerpoint presentation to another in VBA? Powerpoint幻灯片:如何将我在一张幻灯片上的组合框和文本框控件复制到另一张相同演示文稿的幻灯片上? - Powerpoint slides: how to copy my combobox and textbox controls on one slide to a another slide, same presentation? 是否可以检查一个PowerPoint演示文稿中的幻灯片是否与另一个套牌中的幻灯片相同? - Is it possible to check if a slide in one PowerPoint presentation is the same as a slide in another deck? Excel vba将幻灯片复制到现有的PowerPoint演示文稿 - Excel vba to copy slides to an existing powerpoint presentation 通过宏重新启动 PowerPoint 演示文稿 - Restart PowerPoint Presentation by a Macro Powerpoint和VBA-“模块化”演示 - Powerpoint and VBA - “Modular” presentation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM