--- sc/source/ui/vba//vbaapplication.cxx	
+++ sc/source/ui/vba//vbaapplication.cxx
@@ -87,10 +87,10 @@ protected:
 		return getCurrentDocument(); 
 	}
 public:
-	ActiveWorkbook( uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook(  xContext ){}
+	ActiveWorkbook( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook(  xParent, xContext ){}
 };
 
-ScVbaApplication::ScVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): m_xContext( xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic )
+ScVbaApplication::ScVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): ScVbaApplication_BASE( uno::Reference< vba::XHelperInterface >(), xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic )
 {
 }
 
@@ -102,7 +102,7 @@ ScVbaApplication::~ScVbaApplication()
 uno::Reference< excel::XWorkbook >
 ScVbaApplication::getActiveWorkbook() throw (uno::RuntimeException)
 {
-	return new ActiveWorkbook( m_xContext ); 
+	return new ActiveWorkbook( this, mxContext ); 
 }
 uno::Reference< excel::XWorkbook > SAL_CALL 
 ScVbaApplication::getThisWorkbook() throw (uno::RuntimeException)
@@ -118,10 +118,10 @@ ScVbaApplication::getSelection() throw (
 	{
 		uno::Reference< sheet::XSheetCellRangeContainer > xRanges( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
 		if ( xRanges.is() )
-			return uno::Reference< excel::XRange >( new ScVbaRange( m_xContext, xRanges ) );
+			return uno::Reference< excel::XRange >( new ScVbaRange( this, mxContext, xRanges ) );
 
 	}
-	return uno::Reference< excel::XRange >( new ScVbaRange( m_xContext, xRange ) );
+	return new ScVbaRange( this, mxContext, xRange );
 }
 
 uno::Reference< excel::XRange >
@@ -139,8 +139,7 @@ ScVbaApplication::getActiveCell() throw 
 	sal_Int32 nCursorX = pTabView->GetCurX();
 	sal_Int32 nCursorY = pTabView->GetCurY();
 
-	return uno::Reference< excel::XRange >( new ScVbaRange( m_xContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, 
-										nCursorX, nCursorY ) ) ); 
+	return  new ScVbaRange( this, mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) );
 }
 
 sal_Bool
@@ -205,14 +204,14 @@ ScVbaApplication::setDisplayStatusBar(sa
 uno::Any SAL_CALL
 ScVbaApplication::Workbooks( const uno::Any& aIndex ) throw (uno::RuntimeException)
 {
-	uno::Reference< vba::XCollection > xWorkBooks( new ScVbaWorkbooks( m_xContext ) );
+	uno::Reference< vba::XCollection > xWorkBooks( new ScVbaWorkbooks( this, mxContext ) );
 	if (  aIndex.getValueTypeClass() == uno::TypeClass_VOID )
 	{
 		// void then somebody did Workbooks.something in vba
 	    return uno::Any( xWorkBooks );
 	}
 
-	return uno::Any ( xWorkBooks->Item( aIndex ) );
+	return uno::Any ( xWorkBooks->Item( aIndex, uno::Any() ) );
 }
 
 uno::Any SAL_CALL
@@ -234,7 +233,7 @@ ScVbaApplication::Worksheets( const uno:
 uno::Any SAL_CALL
 ScVbaApplication::WorksheetFunction( ) throw (::com::sun::star::uno::RuntimeException)
 {
-        return uno::makeAny( uno::Reference< script::XInvocation >( new ScVbaWSFunction(m_xContext) ) );
+        return uno::makeAny( uno::Reference< script::XInvocation >( new ScVbaWSFunction( this, mxContext) ) );
 }
 
 uno::Any SAL_CALL 
@@ -250,7 +249,7 @@ ScVbaApplication::Evaluate( const ::rtl:
 uno::Any 
 ScVbaApplication::Dialogs( const uno::Any &aIndex ) throw (uno::RuntimeException)
 {
-	uno::Reference< excel::XDialogs > xDialogs( new ScVbaDialogs( m_xContext ) );
+	uno::Reference< excel::XDialogs > xDialogs( new ScVbaDialogs( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), mxContext ) );
 	if( !aIndex.hasValue() )
 		return uno::Any( xDialogs );
 	return uno::Any( xDialogs->Item( aIndex ) );
@@ -259,7 +258,8 @@ ScVbaApplication::Dialogs( const uno::An
 uno::Reference< excel::XWindow > SAL_CALL 
 ScVbaApplication::getActiveWindow() throw (uno::RuntimeException)
 {
-	return new ScVbaWindow( m_xContext, getCurrentDocument() );
+	// #FIXME sofar can't determine Parent
+	return new ScVbaWindow( uno::Reference< vba::XHelperInterface >(), mxContext, getCurrentDocument() );
 }
 
 uno::Any SAL_CALL 
@@ -336,22 +336,36 @@ ScVbaApplication::CountA( const uno::Any
 ::sal_Int32 SAL_CALL 
 ScVbaApplication::getCalculation() throw (css::uno::RuntimeException)
 {
-	return m_xCalculation;
+	uno::Reference<sheet::XCalculatable> xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW);
+	if(xCalc->isAutomaticCalculationEnabled())
+		return excel::XlCalculation::xlCalculationAutomatic;
+	else
+		return excel::XlCalculation::xlCalculationManual;
 }
 
 void SAL_CALL 
 ScVbaApplication::setCalculation( ::sal_Int32 _calculation ) throw (css::uno::RuntimeException)
 {
-	m_xCalculation = _calculation;
+	uno::Reference< sheet::XCalculatable > xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW);
+	switch(_calculation)
+	{
+		case excel::XlCalculation::xlCalculationManual:
+			xCalc->enableAutomaticCalculation(sal_False);
+			break;
+		case excel::XlCalculation::xlCalculationAutomatic:
+		case excel::XlCalculation::xlCalculationSemiautomatic:
+			xCalc->enableAutomaticCalculation(sal_True);
+			break;
+	}
 }
 
 uno::Any SAL_CALL 
 ScVbaApplication::Windows( const uno::Any& aIndex  ) throw (uno::RuntimeException)
 {
-	uno::Reference< vba::XCollection >  xWindows = ScVbaWindows::Windows( m_xContext );
+	uno::Reference< vba::XCollection >  xWindows = ScVbaWindows::Windows( mxContext );
 	if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
 		return uno::Any( xWindows );
-	return uno::Any( xWindows->Item( aIndex ) );	
+	return uno::Any( xWindows->Item( aIndex, uno::Any() ) );	
 }
 void SAL_CALL 
 ScVbaApplication::wait( double time ) throw (css::uno::RuntimeException)
@@ -378,7 +392,7 @@ ScVbaApplication::wait( double time ) th
 uno::Any SAL_CALL 
 ScVbaApplication::Range( const uno::Any& Cell1, const uno::Any& Cell2 ) throw (uno::RuntimeException)
 {
-	uno::Reference< excel::XRange > xVbRange = ScVbaRange::ApplicationRange( m_xContext, Cell1, Cell2 ); 
+	uno::Reference< excel::XRange > xVbRange = ScVbaRange::ApplicationRange( mxContext, Cell1, Cell2 ); 
 	return uno::makeAny( xVbRange ); 
 }
 
@@ -448,8 +462,17 @@ ScVbaApplication::GoTo( const uno::Any& 
         ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow(); 
         try
         {
-            uno::Reference< table::XCellRange > xRange = ScVbaRange::getCellRangeForName( sRangeName, xDoc, ScAddress::CONV_XL_R1C1 );
-            ScVbaRange* pRange = new ScVbaRange( m_xContext, xRange );
+            uno::Reference< beans::XPropertySet > xProps( getCurrentDocument(), uno::UNO_QUERY_THROW );
+            uno::Reference< container::XNameAccess > xNameAccess( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NamedRanges") ) ), uno::UNO_QUERY_THROW );
+            sal_Bool isNamedReference = xNameAccess->hasByName( sRangeName ); 
+            uno::Reference< table::XCellRange > xRange;
+
+            if ( isNamedReference )
+                xRange = ScVbaRange::getCellRangeForName( sRangeName, xDoc );
+            else
+                xRange = ScVbaRange::getCellRangeForName( sRangeName, xDoc, ScAddress::CONV_XL_R1C1 );
+
+            ScVbaRange* pRange = new ScVbaRange( this, mxContext, xRange );
             uno::Reference< excel::XRange > xVbaSheetRange( pRange );
             if( bScroll )
             {
@@ -580,3 +603,21 @@ ScVbaApplication::setCursor( sal_Int32 _
         }
 	}
 }
+rtl::OUString& 
+ScVbaApplication::getServiceImplName()
+{
+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaApplication") );
+	return sImplName;
+}
+
+uno::Sequence< rtl::OUString > 
+ScVbaApplication::getServiceNames()
+{
+	static uno::Sequence< rtl::OUString > aServiceNames;
+	if ( aServiceNames.getLength() == 0 )
+	{
+		aServiceNames.realloc( 1 );
+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Application" ) );
+	}
+	return aServiceNames;
+}
