How can I determine if MS Office 2007 SP2 is installed?

 ̄綄美尐妖づ 提交于 2019-12-07 04:45:14

问题


In am using MS Word via OLE to produce documents from my application. I want to give the users that have MS Office 2007 SP2 installed the ability to save the documents as PDF. This is only available in SP2, and the option should be hidden if the service pack is not installed (and of course also for users of previous versions of MS Office).

Is this information available anywhere, like in the registry or any configuration file?


回答1:


Couldn't find anything helpful for you but here is something which you might find useful.

Office version is stored in registry

HKEY_LOCAL_MACHINE \Software\Microsoft\Office\12.0\Common\productVersion

the value 12.0 changes for office 2003 and 2007. This key has a number. I think checking this number for different version (with/without SP1/SP2) and see if there sia difference.




回答2:


For the actual version infos that apply to the individual service packs have a look at this well hidden kb entry:

http://support.microsoft.com/kb/928116




回答3:


There are different plugins from Microsoft to provide the print to PDF feature:

  • 2007 Microsoft Office Add-in: Microsoft Save as PDF or XPS
  • 2007 Microsoft Office Add-in: Microsoft Save as PDF
  • 2007 Microsoft Office Add-in: Microsoft Save as XPS (does NOT come with PDF support)

and SP2 installs these Addins too.

I was looking for a way to test if the PDF feature is installed or not. The following file is only present if the PDF feature is installed (by an add-in or by the SP) on a machine:

C:\Program Files\Common Files\Microsoft Shares\Office12\EXP_PDF.DLL



回答4:


The update is installed in the following registry key.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00002109030000000000000000F01FEC\Patches\6D6C63B08D5FFAE4FB4934672A03DAB5




回答5:


Ok, this is a bit late but you can determine the Service pack directly from VBA without having to mess with the registry. Obviously you'd need to update it as Microsoft updates Office.

Using the support pages for the different versions off Office you can get the build number and use a function to determine the service pack etc. Office 2007 shows slight discrepancies between the different applications within office so you'd have to tweak as required.

  • Office 2007: http://support.microsoft.com/kb/928116
  • Office 2010: http://support.microsoft.com/kb/2687455 (half way down the page describes the build numbers)

Then a function as follows will do the job for Excel Office 2007+:

Function DetermineExcelServicePack() As String
    Dim sReturn As String

    If Application.Version = "12.0" Then
        If Application.Build < 6214 Then
            sReturn = "Excel 2007, RTM"
        ElseIf Application.Build < 6425 Then
            sReturn = "Excel 2007, SP1"
        ElseIf Application.Build < 6611 Then
            sReturn = "Excel 2007, SP2"
        Else
            sReturn = "Excel 2007, SP3"
        End If
    ElseIf Application.Version = "14.0" Then
        If Application.Build < 6029 Then
            sReturn = "Excel 2010, RTM"
        ElseIf Application.Build < 7015 Then
            sReturn = "Excel 2010, SP1"
        Else
            sReturn = "Excel 2010, SP2"
        End If
    ElseIf Application.Version = "15.0" Then
        sReturn = "Excel 2013, RTM"
    Else
        sReturn = "This version (" & Application.Version & "-" & Application.Build & ") is not supported by this function"
    End If

    DetermineExcelServicePack = sReturn
End Function



回答6:


Programatically check whether version of the MSO.DLL file is greater than or equal to :

"12.0.6425.1000"

This is the value for the file if SP2 and above is installed.



来源:https://stackoverflow.com/questions/2514511/how-can-i-determine-if-ms-office-2007-sp2-is-installed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!