- 
    Bug 
- 
    Resolution: Done
- 
    P4: Low 
- 
    5.9.9, 5.10.1, 5.11.3, 5.12.6, 5.13.2, 5.14.0
- 
    None
- 
    Windows 10, Office 2010
- 
        
- 
        974bead30f32a832180126944973c82f5bc6f6e2 (qt/qtactiveqt/5.14)
Code example:
CoInitialize(NULL); QAxObject *app = new QAxObject("Word.Application"); QAxObject *wordBasic = app->querySubObject("WordBasic"); wordBasic->dynamicCall("DisableAutoMacros(bool)", QVariant(true));
It will throw an error
QAxBase: Error calling IDispatch member DisableAutoMacros: Member not found
I found out that IDispatch::Invoke only accepts a NULL pVarResult argument for DisableAutoMacros method.
Here is my naive patch for Qt 5.12.6
--- qaxbase.cpp	2019-11-05 15:47:56.000000000 +0800
+++ qaxbase.cpp	2020-01-21 10:23:06.693994100 +0800
@@ -4005,6 +4005,11 @@
     UINT argerr = 0;
 
     HRESULT hres = Invoke(disp, dispid, IID_NULL, LOCALE_USER_DEFAULT, disptype, ¶ms, res, &excepinfo, &argerr);
+    if (hres == DISP_E_MEMBERNOTFOUND && (disptype & DISPATCH_METHOD) != 0) {
+        memset(&excepinfo, 0, sizeof(excepinfo));
+        argerr = 0;
+        hres = Invoke(disp, dispid, IID_NULL, LOCALE_USER_DEFAULT, disptype, ¶ms, nullptr, &excepinfo, &argerr);
+    }
 
     if (disptype == (DISPATCH_METHOD|DISPATCH_PROPERTYGET) && hres == S_OK && varc) {
         for (int i = 0; i < varc; ++i)
- relates to
- 
                    QTBUG-81545 QAxBase::querySubObject cannot find methods or properties of MS Word when working documents with VBA macros -         
- Reported
 
-         
| For Gerrit Dashboard: QTBUG-81543 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 287295,2 | Workaround for Application.WordBasic.DisableAutoMacros not working | 5.14 | qt/qtactiveqt | Status: MERGED | +2 | 0 |