Use RunDLL32.exe to run a different programs .DLL file RRS feed

  • Question

  • Thank you for taking the time to read my question.

    I have an Access DB is on a Windows 2012 server shared via Citrix that stores info along with a link to related pictures. Users send an email, Outlook parses the email and creates a text file that Access imports and saves the attached pictures to a folder. The pictures and data are related in the DB.

    Users are starting to attach .heic picture files. My server does not have a way to open them so I need to convert them from .heic to .jpg.

    I have a program that can do this but I have to use their DLL to do this as my users cannot use the program (only the Access DB is shared via Citrix). 

    How do I call RunDLL32.exe and then reference the conversion programs .dll with the parameters?

    I have tried this:

    Shell ("C:\Windows\System32\RunDLL32.exe CopyTransHEICforWindows.dll,HeicToJPEG 'C:\Users\pforms\Desktop\HEIC\20191016-18120272562_UploadPDFWordExcel_1.HEIC' '' 100 false,0")

    but I get a message saying:

    Title: RunDLL
    Message: There was a problem starting CopyTransHEICforWindows.dll The specified module could not be found

    If I do this:

    Shell ("C:\Windows\System32\RunDLL32.exe C:\Program Files (x86)\CopyTrans HEIC for Windows\CopyTransHEICforWindows.dll,HeicToJPEG 'C:\Users\pforms\Desktop\HEIC\20191016-18120272562_UploadPDFWordExcel_1.HEIC' '' 100 false,0")

    I get a message saying:

    Title: RunDLL
    Message: There was a problem starting C:\Program The specified module could not be found

    I have the following from the vendor of the conversion software:

    You can call CopyTrans HEIC DLLs by using the following instruction: <o:p></o:p>

    * Convert HEIC image file to JPEG unicode version. This function is usually called using Rundll32 as RUNDLL32.EXE CopyTransHeicDecoder.dll,HeicToJPEG "d.heic" "" 100 false
    @param hwnd - calling process window handle, can be NULL
    @param hinst - module instance, can be NULL
    @param cmdline - parameters command line takes 4 params
    - source filename - source file name
    - dest filename - jpeg dest file name, if empty will be autogenerated from source name
    - jpegCompression - 0 to 100, default is M_DefaultJPEGCompression (93, iOS default)
    - overwrite - if destination file name is set, true to overwrite existing, false to fail
    @param nCmdShow - can be 0
    @returns S_OK on success, E_FAIL on fail; consult c:\Users\All Users\WindSolutions\CopyTransHEICforWindows\ logs for more info
    @example HeicToJPEGW(NULL, NULL, L"\"c:\\pics\\myheic long name.heic\" \"c:\\pics\\my new jpeg.jpg\" 93 false", 0)

    STDAPI __export HeicToJPEGW(HWND hwnd, HINSTANCE hinst, LPWSTR cmdline, int nCmdShow);
    STDAPI __export HeicToJPEG(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);<o:p></o:p>

    Any pointers would be greatly appreciated.


    I also tried this:

    '64 bit
    'File not found error (can't find C:\Program Files\CopyTrans HEIC for Windows\CopyTransHEICforWindows.dll)
    Private Declare PtrSafe Function HEIC Lib "C:\Program Files\CopyTrans HEIC for Windows\CopyTransHEICforWindows.dll" (ByRef Param As String)

    '32 bit
    'Crashes Access
    'Private Declare Function HEIC Lib "C:\Program Files (x86)\CopyTrans HEIC for Windows\CopyTransHEICforWindows.dll" (ByRef Param As String)

    Private Sub Command0_Click()
        HEIC "HeicToJPEG 'C:\Users\pforms\Desktop\HEIC\20191016-18120272562_UploadPDFWordExcel_1.HEIC' '' 100 FALSE"
    End Sub


    • Edited by mbrad Tuesday, November 26, 2019 5:47 PM more examples found on line
    Tuesday, November 26, 2019 5:07 PM

All replies

  • Probably

    instead of




    Tuesday, November 26, 2019 8:11 PM
  • Hum, somewhat of a challenge  to figure this out. Is there a web site or link to the  library with additional information?

    It not clear if this is managed code, or un-managed?

    Is there a docs or download page?

    It is a bit tough to suggest much more then what you shared so far. But then again, it not 100% clear as to the command options, (say using Shell()), or that of say referencing the .dll and using it directly from VBA.

    I can't promise much, but unless someone here has used the actual library with Access, it is hard to suggest much more then what you shared. 


    Albert D. Kallal (Access MVP 2003-2017)

    Edmonton, Alberta Canada

    Tuesday, November 26, 2019 8:48 PM
  • I was able to get this code to run without errors but the image is not converted from .heic to .jpg. I have emailed the vendor.

    Shell ("C:\Windows\SysWOW64\RunDLL32.exe C:\Program Files\CopyTrans HEIC for Windows\CopyTransHEICforWindows.dll,HeicToJPEG 'C:\Users\pforms\Desktop\HEIC\20191016-18120272562_UploadPDFWordExcel_1.HEIC' '' 100 false",0)

    Not sure if anyone sees any "VBA" errors


    Wednesday, November 27, 2019 2:37 PM
  • Try this, assuming you are dealing with 32 bit dll on 64 bit system -

    Shell("C:\Windows\SysWOW64\Rundll32.exe ""C:\Program Files (x86)\CopyTrans HEIC for Windows\CopyTransHEICforWindows.dll"",HeicToJPEG C:\Users\pforms\Desktop\HEIC\20191016-18120272562_UploadPDFWordExcel_1.HEIC """" 100 false", 0)

    • Edited by RLWA32 Thursday, November 28, 2019 2:33 PM
    Thursday, November 28, 2019 2:31 PM