1
votes

I just finished developing a custom VB.NET App for a client that relies heavily on automation of Powerpoint through Microsoft.Office.Interop.Powerpoint. It works great on my computer (running Windows 8, Office 2010, and Visual Studio 2010), but it fails to install on my client's computer, which runs Windows 7 and Office 2007. I think the issue is the reference to the "Microsoft Office 14.0 Object Library" and "Microsoft.Office.Interop.PowerPoint" ver 14.0, but I have no idea how to change the references to version 12.0, which presumably would be compatible with Office 2007.

The only versions available in "References" in my Visual Studio are the 14.0 ones. Is there any way to get a hold of older versions, or to otherwise make my app backwards compatible?

The error my client sees when trying to install says "application requires that assembly Microsoft.Interop.Powerpoint Version 14.0.0.0 be installed in the Global Assembly Cache (GAC) first."

1
you will have to refer to the 2007 version of the dll from the source code I think.urlreader

1 Answers

0
votes

I've done this in the past for Word and I suspect it can work for PowerPoint as well. But it can be a bit risky, but this is one area where VB.Net actually shines :)

Essentially, you develop with a debug version and deploy with a release version and the objects use different binding types. Conditional compilation controls the switch between the two methods of binding.

Caveat: I haven't tried this, but it should be very close to what you're after.

' Code for where you declare you your objects...
#If DEBUG Then
    ' Create the object for the dev environment using early binding
    Protected PowerpointApp As PowerPoint.Application = Nothing
    Protected PowerpointDoc As PowerPoint.Document = Nothing
#Else
    ' Create the object for the compiled application using late binding
    Protected PowerpointApp As Object = Nothing
    Protected PowerpointDoc As Object = Nothing
#End If


' Code for where you create your objects...
#If DEBUG Then
    ' Declare the object for the dev environment using early binding
    PowerpointApp = New PowerPoint.Application
#Else
    ' Declare the object for the compiled application using late binding
    PowerpointApp = CreateObject("POWERPOINT.APPLICATION")
#End If
' Use whichever method you want to open the document
PowerpointDoc = PowerpointApp.Documents.Open(etc, etc, etc, ...)