summaryrefslogtreecommitdiff
path: root/sc/source/ui/vba/vbaworkbooks.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/vba/vbaworkbooks.cxx')
-rw-r--r--sc/source/ui/vba/vbaworkbooks.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx
index bd52292cfa5a..e3b608b33942 100644
--- a/sc/source/ui/vba/vbaworkbooks.cxx
+++ b/sc/source/ui/vba/vbaworkbooks.cxx
@@ -144,9 +144,14 @@ ScVbaWorkbooks::Add( const uno::Any& Template )
// need to set up the document modules ( and vba mode ) here
excel::setUpDocumentModules( xSpreadDoc );
- if( xSpreadDoc.is() )
- return getWorkbook( mxContext, xSpreadDoc, mxParent );
- return uno::Any();
+ if (!xSpreadDoc.is())
+ return uno::Any();
+
+ uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, mxParent );
+ uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
+ if (xWBook.is())
+ xWBook->Activate();
+ return aRet;
}
void SAL_CALL