Library Not Registered

J

Jay

I'm running the following code in an Excel macro, to open up a powerpoint
document from within Excel. It works fine on my computer and on the
computers of two other users. When I try to run it on one computer, though,
I get an error message "Library Not Registered" when it gets to the line "Set
app = New PowerPoint.Application". Any thoughts of how to fix this would be
greatly appreciated...THANKS!

Function GetPPT() As PowerPoint.Presentation
'this procedure opens a powerpoint presentation for output
Dim app As PowerPoint.Application
Dim strFile As String


strFile = Application.GetOpenFilename("(*.ppt), *.ppt", , "Open File")

If strFile = "False" Then

Else
Set app = New PowerPoint.Application
app.Visible = msoTrue
Set GetPPT = app.Presentations.Open(Filename:=strFile, ReadOnly:=msoFalse)
End If

End Function
 
J

Jay

YIKES! Any other advice LOL? I'll keep reading through this to see if I can
figure it out. Thanks,

Jay
 
P

Peter T

In the Tools menu, References, if you see any references marked MISSING,
uncheck close the dialog and start again

Scroll down and check "Microsoft Powerpoint x.0 Object Library" where x
refers to the Office version.

If there's any possibility the file will be used with in lower version,
forget about the reference (indeed remove it if it exists) and adapt to
"Late Binding".
Briefly, this means changing and PP related declarations to "As Object",
also changing any PP constants to their intrinsic values (not that I see any
in your code snippet).

Change
Function GetPPT() As PowerPoint.Presentation
Dim app as PowerPoint.Application
Set app = New PowerPoint.Application
to
Function GetPPT() As Object
Dim app as Object
Set app = CreateObject("powerpoint.application")

Elsewhere you will probably need to change other As PowerPoint.something to
As Object

Code may run slightly slower (though you might not notice) and you will lose
intellisense.

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top