diff options
-rw-r--r-- | basic/source/runtime/stdobj.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index 80d637aa39bb..a73f7efd764a 100644 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -775,11 +775,23 @@ SbxVariable* SbiStdObject::Find( const OUString& rName, SbxClassType t ) && ( p->nHash == nHash_ ) && ( rName.equalsIgnoreAsciiCaseAscii( p->pName ) ) ) { - SbiInstance* pInst = GetSbData()->pInst; bFound = true; if( p->nArgs & COMPTMASK_ ) { - if ( !pInst || ( pInst->IsCompatibility() && ( NORMONLY_ & p->nArgs ) ) || ( !pInst->IsCompatibility() && ( COMPATONLY_ & p->nArgs ) ) ) + bool bCompatibility = false; + SbiInstance* pInst = GetSbData()->pInst; + if (pInst) + { + bCompatibility = pInst->IsCompatibility(); + } + else + { + // No instance running => compiling a source on module level. + const SbModule* pModule = GetSbData()->pCompMod; + if (pModule) + bCompatibility = pModule->IsVBACompat(); + } + if ((bCompatibility && (NORMONLY_ & p->nArgs)) || (!bCompatibility && (COMPATONLY_ & p->nArgs))) bFound = false; } break; |