保持字体格式从Excel到Powerpoint

我有一个VBAmacros将Excel中的图表粘贴到PowerPoint中,这个工程。

我调整了macros以将同一工作表的某些单元格的单元格内容复制到PowerPoint中。 尽pipe在Excel中设置字体大小与PowerPoint模板中的字体大小相同,但在macros复制之前(两者均为40点),字体将在运行macros之前在Excel中设置的18点而不是40点粘贴。

处理所有这些的代码如下所示:

'Opens a new PowerPoint presentation based on template and pastes data into Slide 2 of Powerpoint from Excel Dim PPApp As PowerPoint.Application, PPPres As PowerPoint.Presentation, PPSlide As PowerPoint.Slide, PPShape As Object, PPChart As Object Dim XLws As Worksheet Set XLws = ActiveSheet Set PPApp = New PowerPoint.Application Set PPPres = PPApp.Presentations.Open("C:\Users\Colin\Dropbox (Edge45)\Edge45 Team Folder\Edge45 Company Documents\Templates\Powerpoint Templates\Edge45 Monthly Report Template Macro.potm", Untitled:=msoTrue) PPApp.Visible = True Set PPSlide = PPPres.Slides(12) XLws.ChartObjects(1).Copy ' or XLws.ChartObjects("Chart 2").Copy Set PPChart = PPSlide.Shapes.PasteSpecial(DataType:=ppPasteDefault) With PPChart .Left = 18 .Height = 322 .Top = 121 .Width = 531 End With 'Copies Contents of Cells Q36 and R36 in excel worksheet and pastes as text into slide 13 of presentation XLws.Range("Q36:R36").Copy Set PPChart = PPSlide.Shapes.PasteSpecial(DataType:=ppPasteDefault) Set PPSlide = PPPres.Slides(13) 

科林,

你复制后是否改变字体大小? 也许它是自动链接/更新的。

如果您可以使用其中一个粘贴选项手动复制它,我build议使用以下文章中引用的ExecuteMso命令来更准确地模拟您正在执行的操作:

如何将图表从Excel复制到PowerPoint?