A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
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.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
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.
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.