Excel – PC unable to find EXP_PDF.DLL

dllmicrosoft excelvba

I have an Excel workbook that uses VBA to create PDFs from sheets, and send them via email through Outlook.

When I click the button to create the PDFs and send, Microsoft Visual Basic gives me the follow error message:

Compile error: Can't find project or library

The debugger then highlights the following code:

 Function Create_PDF_Sheet_Level_Names(NamedRange As String, FixedFilePathName As String, _
                                       OverwriteIfFileExist As Boolean, OpenPDFAfterPublish As Boolean) As String

    'This function will create a PDF with every sheet with
    'a sheet level name variable <NamedRange> in it

         Dim FileFormatstr As String
         Dim Fname As Variant
         Dim Ash As Worksheet
         Dim sh As Worksheet
         Dim ShArr() As String
         Dim s As Long
         Dim SheetLevelName As Name

         'Test If the Microsoft Add-in is installed
         If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
         & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then

...

In particular, the "Environ" in:

        'Test If the Microsoft Add-in is installed
         If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
         & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then

It should be able to find EXP_PDF.dll, as it does exist at:

C:\Program Files\Common Files\microsoft shared\OFFICE12\EXP_PDF.DLL

The user is using Office 2007, so the correct corresponding folder is OFFICE12.

I have attempted to run Regsvr32.exe in order to register the dll, but it doesn't work.

Best Answer

Here is a site with a solution for this problem

Copy file exp_pdf.dll to the installation directory of the program that is requesting exp_pdf.dll. If that doesn't work, you will have to copy exp_pdf.dll to your system directory. By default, this is:
Windows 95/98/Me - C:\Windows\System Windows NT/2000 - C:\WINNT\System32 Windows XP, Vista, 7 - C:\Windows\System32

If you use a 64-bit version of Windows, you should also copy exp_pdf.dll to C:\Windows\SysWOW64\

Make a backup copy of the original files Overwrite any existing files Reboot your computer. If the problem still occurs, try the following: Open Windows Start menu and select "Run...". Type CMD and press Enter (or if you use Windows ME, type COMMAND) Type regsvr32 exp_pdf.dll and press Enter.

If you can't find windows directory try the following: Open Windows Start menu and select "Run...". Type CMD and press Enter (or if you use Windows ME, type COMMAND) Type %WINDIR% and press Enter.

Related Question