View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Excel 2003 VBProject Missing reference

I'm just starting to look at this myself, but I think that using late binding
might solve your problem. I just "threw" this together and didn't set the
ref for PowerPoint. I ran this in Excel. I think it's probably easier to
develop with early binding and then convert to late binding.

Sub test()
Dim PPTApp As Object

On Error Resume Next
Set PPTApp = GetObject(, "PowerPoint.Application")
On Error GoTo 0

If PPTApp Is Nothing Then
Set PPTApp = CreateObject("PowerPoint.application")
End If
Debug.Print PPTApp.Name

PPTApp.Quit

End Sub

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"John Howard" wrote:

Within Excel 2003 this macro:

Private Sub Workbook_Open()

Dim wkBook As Workbook
Dim refCurr As Object
Dim i As Integer

Set wkBook = ThisWorkbook

'Deselects 'Missing'(IsBroken) references from the VBProject References
dropdown list.
For i = wkBook.VBProject.References.Count To 1 Step -1
Set refCurr = wkBook.VBProject.References(i)

If refCurr.IsBroken Then
wkBook.VBProject.References.Remove refCurr
End If
Next

End Sub

fails to remove the VBProject Reference
MISSING: Microsoft Powerpoint 12.0 Object Library.
and returns Runtime Error 48, Error in loading DLL.

What code will programatically remove the missing reference?

The workbook was originally developed in Excel 2007 xlsm format and will
continue to be distributed far and wide with instruction to Save As an xls
file if pre 2007 versions are to be used.

I am understanably averse to having users unprotect the VB Editor to allow
manual reference removal.

And so wil be most grateful for any forthcoming solution.

Thanks in anticipation

--
Regards
John Howard
Sydney, Australia