Run-time Error '48' : File not found - When using VBA6 code in Word 2010 64 bit version RRS feed

  • Question

  • Hi,

    Our product has Macros written in VBA 6 for Word. Till Office 2007 versions it works fine. But when these Macros are loaded in Office 2010 64 bit,  the code was not compiling.

    The following piece of code was giving the below mentioned error.

    Private Declare Sub MyFunction Lib "My_Lib.dll" (ByVal InStr As String, ByVal OutStr As String, ByVal OutSize As Long)

    Compile error:
    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.

    So the Function Declaration was modified as given below to make it compatible with VBA7

    #If VBA7 Then
    Private Declare PtrSafe Sub MyFunctionLib "C:\Progra~1\..\My_Lib.dll" (ByVal InStr As String, ByVal OutStr As String, ByVal OutSize As Long)
    Private Declare Sub MyFunctionLib "My_Lib.dll" (ByVal InStr As String, ByVal OutStr As String, ByVal OutSize As Long)
    #End If

    Now the compilation error is removed. But when running the product and while launching Word from it, the following run-time error is generated

    Run-time error '48' : File not found : "C:\Progra~1\..\My_Lib.dll"

    I tried a lot to resolve this, but with no success. The dll (32 bit) is present there in the location given. Till office 2007 there is no problem. Even in Office 2010 32bit version, the product runs fine.

    The macros are implemented in "" and is placed in the Startup Folder for Office. Our product is installed in C:Program Files (x86). The dll is a non register-able dll. I tried adding the dll in the references to VBA code. But still facing the same issue. Please suggest some solutions.

    Wednesday, January 13, 2016 4:31 AM


  • Hi Karun,

    It depends on how you developing and register the My_Lib.dll. You need to make sure this DLL is enable used by the 64-bit application.

    If this DLL is developed by yourself, I suggest that you reopen a new thread in the corresponding forum for the language you were developing with this DLL.

    If not, you need to contact the vendor of this DLL to make it support with 64-bit application.

    Regards & fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 14, 2016 3:08 AM