Late binding PowerPoint 2003 and 2007

  • Thread starter Thread starter Thomas Wieczorek
  • Start date Start date
T

Thomas Wieczorek

Hello!

I am using late binding to start PowerPoint. I have two versions of
it: PowerPoint 2003 on my development PC and 2007 at the client.
Starting PowerPoint works on both machines, but I can't run a
presentation on the other computer.
I get a COMException, when I start it:
Exception in PowerPointViewer.Start():
System.Runtime.InteropServices.COMException (0x80004005): Unspecified
error
at
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack)
at PowerPointViewer.Start()

I already looked at http://support.microsoft.com/kb/814912/en-us, but
it doesn't soll my problem.

<code>
Class PowerPointViewer
Private Shared powerpointApp As Object = Nothing
Private presentation As Object
Private filePath as String

Public Sub New(ByVal _filePath As String)
filePath = _filePath
End Sub

Sub Start()
If IsNothing(powerpointApp) Then
Log("Start PowerPoint ")
powerpointApp = CreateObject("PowerPoint.Application")
End If

Log("Open PowerPoint Presentation" & filePath)
' HERE: The COMException happens when calling Open
presentation = powerpointApp.Presentations.Open(filePath, , ,
False)
' this doesn't work, too
'presentation = powerpointApp.Presentations.Open(filePath, False,
False, False)

' some code ommited
presentation.Run()
End Sub
End Class
</code>



I am using .Net 1.1.4332 and Visual Studio 2003
 
That doesn't look right: Powerpoint programming is a minority activity but
if the object model is consistent with Word and Excel, you will need to add
an object to the presentations collection first.

Why not use GetObject? You will open the presentation directly. it will look
something like this

presentation = GetObject("file path","Powerpoint.Application")
Presentation.run()
 
whoops, that only works if the presentation is open. back to point one. you
probably need to add the presentation to the class of presentations rather
than just open it.
A

Alan Gillott said:
That doesn't look right: Powerpoint programming is a minority activity but
if the object model is consistent with Word and Excel, you will need to
add an object to the presentations collection first.

Why not use GetObject? You will open the presentation directly. it will
look something like this

presentation = GetObject("file path","Powerpoint.Application")
Presentation.run()

Thomas Wieczorek said:
Hello!

I am using late binding to start PowerPoint. I have two versions of
it: PowerPoint 2003 on my development PC and 2007 at the client.
Starting PowerPoint works on both machines, but I can't run a
presentation on the other computer.
I get a COMException, when I start it:
Exception in PowerPointViewer.Start():
System.Runtime.InteropServices.COMException (0x80004005): Unspecified
error
at
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack)
at PowerPointViewer.Start()

I already looked at http://support.microsoft.com/kb/814912/en-us, but
it doesn't soll my problem.

<code>
Class PowerPointViewer
Private Shared powerpointApp As Object = Nothing
Private presentation As Object
Private filePath as String

Public Sub New(ByVal _filePath As String)
filePath = _filePath
End Sub

Sub Start()
If IsNothing(powerpointApp) Then
Log("Start PowerPoint ")
powerpointApp = CreateObject("PowerPoint.Application")
End If

Log("Open PowerPoint Presentation" & filePath)
' HERE: The COMException happens when calling Open
presentation = powerpointApp.Presentations.Open(filePath, , ,
False)
' this doesn't work, too
'presentation = powerpointApp.Presentations.Open(filePath, False,
False, False)

' some code ommited
presentation.Run()
End Sub
End Class
</code>



I am using .Net 1.1.4332 and Visual Studio 2003
 
whoops, that only works if the presentation is open. back to point one. you
probably need to add the presentation to the class of presentations rather
than just open it.
A

Thank you for your replies.
It works for me now. The error was just that the office.dll was
missing in the .Net Runtime folder. It seems that neither Office 2007
nor the PIA installed it.

Regards, Thomas
 
Back
Top