Share via

Save As PDF (Add-In) for Office 2010 64 bit

Anonymous
2012-05-08T22:58:47+00:00

I was using Office 2007 32bit on a Win7 64 bit machine, and had code to check if the Microsoft's Save As PDF was installed.  With the laptop and Office being 64bit now, I'm getting Compile errors : The code in this project must be updated for use on 64-bit systems.  Please review and update Declare statements and then mark them with the PtrSafe attribute."

Can I do without the code, or do I need to update the code.  The code that I was using was:

Option Private Module

Option Explicit

Public Declare Function SHGetSpecialFolderLocation _

Lib "shell32" (ByVal hWnd As Long, _

ByVal nFolder As Long, ppidl As Long) As Long

Public Declare Function SHGetPathFromIDList _

Lib "shell32" Alias "SHGetPathFromIDListA" _

(ByVal Pidl As Long, ByVal pszPath As String) As Long

Public Declare Sub CoTaskMemFree Lib "ole32" (ByVal pvoid As Long)

Public Const CSIDL_PERSONAL = &H5

Public Const CSIDL_DESKTOPDIRECTORY = &H10

Public Const CSIDL_PROGRAM_FILES_COMMON = &H2B

Public Const MAX_PATH = 260

Public Const NOERROR = 0

Sub CheckPDF()

Dim isOK As String

isOK = SpecFolder(CSIDL_PROGRAM_FILES_COMMON) & "\Microsoft Shared\OFFICE12\EXP_PDF.DLL"

If Dir(isOK) = "" Then

MsgBox "The Purchase Order feature will not function because" & vbNewLine & _

               "the Microsoft Save-As-PDF Add-in is not installed." & vbNewLine & _

               "Please download and install Microsoft's free Save-As-PDF Add-in" & vbNewLine & _

               "feature from www.microsoft.com or contact your IT support."

End If

End Sub

Public Function SpecFolder(ByVal lngFolder As Long) As String

Dim lngPidlFound As Long

Dim lngFolderFound As Long

Dim lngPidl As Long

Dim strPath As String

strPath = Space(MAX_PATH)

lngPidlFound = SHGetSpecialFolderLocation(0, lngFolder, lngPidl)

If lngPidlFound = NOERROR Then

lngFolderFound = SHGetPathFromIDList(lngPidl, strPath)

If lngFolderFound Then

SpecFolder = Left$(strPath, _

InStr(1, strPath, vbNullChar) - 1)

End If

End If

CoTaskMemFree lngPidl

End Function

thank you,

KSJ

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2012-05-09T05:51:05+00:00

    Save as PDF is not a separate add-in in Office 2010, it is built-in, so there is no need to adapt and use this code.

    Was this answer helpful?

    10+ people found this answer helpful.
    0 comments No comments