我编写了一个从excel导出到powerpoint并在Excel / Powerpoint 2013,2010中正常工作的宏。
但是我在另一个版本的Excel 2010上测试了它并得到了一个VBA错误,它缺少powerpoint对象库15.我尝试使用powerpoint库14运行宏并且能够但是它没有重新格式化幻灯片或者做我正在做的很多格式化。
安装对象库的最佳方式/最简单方法是什么。我可以从参考选项卡浏览和导入文件吗?如果是这样,我如何找到对象库的dl文件?我需要告诉客户,所以我想尽可能简单。
注意我的代码如下。我很难将此更改为每个亚当的早期绑定反馈。
Sub CopyDataToPPT()
'Const ppLayoutBlank = 12
Dim objWorkSheet As Worksheet
Dim objRange As Range
Dim objPPT As Object
Dim objPresentation As Object
Dim shapePPTOne As Object
Dim intLocation, intHeight, inLayout As Integer
Dim strRange As String
Dim boolOK As Boolean
Application.ScreenUpdating = False
'Set objWorkSheet = ThisWorkbook.ActiveSheet
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
inLayout = 1
Set objPresentation = objPPT.Presentations.Add
boolOK = False
strRange = "p19:y48" '<- here
intHeight = 430
boolOK = True
If boolOK = True Then
Set objslide = objPresentation.Slides.Add(1, inLayout)
objPresentation.Slides(1).Layout = ppLayoutTitleOnly
objPresentation.Slides(1).Shapes.Title.TextFrame.TextRange.Text = "Reebok- " & Sheets("Brand Personality").Cells(3, 2)
Set objRange = Sheets("Brand Personality").Range(strRange)
objRange.Copy
DoEvents
Set shapePPTOne = objslide.Shapes.PasteSpecial(DataType:=ppPasteEnhancedMetafile, Link:=msoFalse)
shapePPTOne(1).Left = 220
shapePPTOne(1).Top = 100
shapePPTOne(1).Height = intHeight
Application.CutCopyMode = False
End If