Hello this is a follow up on this ticket: How to resolve Missing Powerpoint 15 Object Library Error
I developed a macro that exports something from excel to powerpoint in Excel 2010. I ran into issues when I tried to deploy to people with Office 2010. Per the advice of SO I changed the references to late binding to avoid version dependency. It is now possible to open and run the macro on office 2010 but users still see the error message: "Trouble loading DLL". It says missing 15 Powerpoint VBA when I click into the references. If I uncheck this and check 14 it will run, but it seems like someone in 2010 will have to do this each time they run the Macro. Any advice on how to proceed? I tried to add the following to resolve the issue
1: Code to repair refrences
Sub RemoveMissingReferences()
Dim Intrefcount As Integer
With ThisWorkbook.VBProject.references
For Intrefcount = 1 To .Count
If Left(.Item(Intrefcount).Description, 7) = "Missing" Then
.Remove .Item(Intrefcount)
End If
Next Intrefcount
End With
End Sub
2: Actual macro which exports from excel to PPT
Sub CopyDataToPPTBrandPers()
Const ppLayouttitleonly = 11
Const ppPasteEnhancedMetafile = 2
Dim objWorkSheet As Worksheet
Dim objRange As Range
Dim objPPT, objslide, objPresentation, shapePPTOne As Object
Dim intLocation, intHeight, inLayout, intRefCount As Integer
Dim strRange As String
Dim boolRefExists As Boolean
Application.ScreenUpdating = False
boolRefExists = False
With ThisWorkbook.VBProject.references
For intRefCount = 1 To .Count
If .Item(intRefCount).Description = _
"Microsoft PowerPoint 14.0 Object Library" Then
boolRefExists = True
End If
Next intRefCount
End With
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
inLayout = 1
strRange = "p19:y48" '<- here
intHeight = 430
Set objPresentation = objPPT.Presentations.Add
Set objslide = objPresentation.Slides.Add(1, inLayout)
objslide.Layout = ppLayouttitleonly
With objslide.Shapes.Title
With .TextFrame.TextRange
.Text = "Reebok - " & Sheets("Brand Personality").Cells(3, 2)
.Words.Font.Bold = msoTrue
.Font.Color = RGB(255, 255, 255)
End With
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(192, 0, 0) '160, 157, 117)
.Height = 50
End With
Set objRange = Sheets("Brand Personality").Range(strRange)
objRange.Copy
Set shapePPTOne = objslide.Shapes.PasteSpecial(DataType:=ppPasteEnhancedMetafile, _
Link:=msoFalse)
DoEvents
If boolRefExists = True Then
shapePPTOne.Left = 100
shapePPTOne.Top = 100
shapePPTOne.Height = intHeight
Else
shapePPTOne(1).Left = 220
shapePPTOne(1).Top = 100
shapePPTOne(1).Height = intHeight
End If
Set shapePPTOne = Nothing
'Set shapePPTTwo = Nothing
Set objRange = Nothing
Set objPPT = Nothing
Set objPresentation = Nothing
Set objslide = Nothing
Application.CutCopyMode = False
Application.ScreenUpdating = True
MsgBox "Update Complete"
End Sub
Late Bindthen just remove anyReferenceand save the.xlsmfile.Late Bindingdoesn't need any reference at all. AlsomsoTrueandmsoFalseare PPt variables, so need to change it to-1and0respectively. Then try to scan again your code, I could've missed other variables. - L42