VBA program executing SAP RFCs works in Excel 2016 on-prem, but not in Office 365 (Run-time error 20080008…Bad Variant Type)

后端 未结 1 1239
栀梦
栀梦 2021-01-26 14:22

Let me first say that I saw the other two threads that mentioned this issue here and here, but they didn\'t help me solve my problem.

I\'ve been testing a program for se

相关标签:
1条回答
  • 2021-01-26 15:10

    It's due to the fact that your Office is in 64 bits version, and SAP GUI for Windows up to version 7.60 is in 32 bits (next SAP GUI version 7.70 should be in 64 bits, so it should work again).

    You have a workaround to make VBA work with SAP GUI 32-bits DLL, by using DLL Surrogate, i.e. by editing the Windows Registry of all incompatible SAP GUI DLL. The original solution was proposed here at SAP Community.

    To simplify the task, you may create my .REG file, execute it to update automatically the Windows Registry, and your VBA macro should then work.

    I duplicate here my .REG file:

    ; ====================================================================================
    ; SAP Logon Unicode Control %ProgramFiles(x86)%\SAP\FrontEnd\SAPgui\wdtlogU.ocx {0AAF5A11-8C04-4385-A925-0B62F6632BEC}
    ; ====================================================================================
    
    [HKEY_CLASSES_ROOT\WOW6432Node\AppID\{0AAF5A11-8C04-4385-A925-0B62F6632BEC}]
    "DllSurrogate"=""
    
    [HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{0AAF5A11-8C04-4385-A925-0B62F6632BEC}]
    "AppID"="{0AAF5A11-8C04-4385-A925-0B62F6632BEC}"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{0AAF5A11-8C04-4385-A925-0B62F6632BEC}]
    
    ; ====================================================================================
    ; SAP Remote Function Call Unicode Control %ProgramFiles(x86)%\SAP\FrontEnd\SAPgui\wdtfuncu.ocx {0AF427E7-03B9-4673-8F21-F33A683BCE28}
    ; ====================================================================================
    
    [HKEY_CLASSES_ROOT\WOW6432Node\AppID\{0AF427E7-03B9-4673-8F21-F33A683BCE28}]
    "DllSurrogate"=""
    
    [HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{0AF427E7-03B9-4673-8F21-F33A683BCE28}]
    "AppID"="{0AF427E7-03B9-4673-8F21-F33A683BCE28}"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{0AF427E7-03B9-4673-8F21-F33A683BCE28}]
    
    ; ====================================================================================
    ; SAP Logon Control (not Unicode) %ProgramFiles(x86)%\SAP\FrontEnd\SAPgui\wdtlog.ocx {B24944D6-1501-11CF-8981-0000E8A49FA0}
    ; ====================================================================================
    
    [HKEY_CLASSES_ROOT\WOW6432Node\AppID\{B24944D6-1501-11CF-8981-0000E8A49FA0}]
    "DllSurrogate"=""
    
    [HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{B24944D6-1501-11CF-8981-0000E8A49FA0}]
    "AppID"="{B24944D6-1501-11CF-8981-0000E8A49FA0}"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{B24944D6-1501-11CF-8981-0000E8A49FA0}]
    
    ; ====================================================================================
    ; SAP Remote Function Call Control (not Unicode) %ProgramFiles(x86)%\SAP\FrontEnd\SAPgui\wdtfuncs.ocx {5B076C03-2F26-11CF-9AE5-0800096E19F4}
    ; ====================================================================================
    
    [HKEY_CLASSES_ROOT\WOW6432Node\AppID\{5B076C03-2F26-11CF-9AE5-0800096E19F4}]
    "DllSurrogate"=""
    
    [HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{5B076C03-2F26-11CF-9AE5-0800096E19F4}]
    "AppID"="{5B076C03-2F26-11CF-9AE5-0800096E19F4}"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{5B076C03-2F26-11CF-9AE5-0800096E19F4}]
    
    0 讨论(0)
提交回复
热议问题