Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 26th, 2011, 04:39 PM
Registered User
Join Date: Oct 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Method InsideHeight of object PlotArea failed

I'm getting - Method 'InsideHeight' of object 'PlotArea' failed. I'm using Access Automation to build Powerpoint presentations and on a slide where I have 2 charts I'm lining up the 2 chart's plot areas so the data on each chart line up. The error does not happen every time I run the code. It appears to happen randomly. I tried putting a Doevents in the code in case there was a timing issue but that has not corrected it. Now once I get the error and the code breaks I do a next and sometimes it continues and other time I get the error again. If I continue to do Next eventually it continues (could be 3 or 4 times before it runs). If a run this code against a single slide it works. If I run it as part of a loop where it is called over and over for many slides I get the error.

Here is my code:

Public Sub Lineup_Charts(xChart1 As Powerpoint.Chart, xChart2 As Powerpoint.Chart)
On Error GoTo Lineup_Charts_Err

Dim sChart1Top As Single
Dim sChart2Top As Single
Dim sChart1Left As Single
Dim sChart2Left As Single

' xChart1 is the data Chart
' xChart2 is the norm Chart
xChart2.PlotArea.InsideHeight = xChart1.PlotArea.InsideHeight ' This is where it fails

xChart2.PlotArea.InsideWidth = xChart1.PlotArea.InsideWidth
sChart1Top = xChart1.Parent.TOP + xChart1.PlotArea.InsideTop + xChart1.ChartArea.TOP
sChart2Top = xChart2.Parent.TOP + xChart2.PlotArea.InsideTop + xChart2.ChartArea.TOP
If sChart1Top > sChart2Top Then
xChart2.Parent.TOP = xChart2.Parent.TOP + (sChart1Top - sChart2Top)
If sChart1Top < sChart2Top Then
xChart2.Parent.TOP = xChart2.Parent.TOP - (sChart2Top - sChart1Top)
End If
End If
sChart1Left = xChart1.Parent.Left + xChart1.PlotArea.InsideLeft + xChart1.ChartArea.Left
sChart2Left = xChart2.Parent.Left + xChart2.PlotArea.InsideLeft + xChart1.ChartArea.Left
If sChart1Left > sChart2Left Then
xChart2.Parent.Left = xChart2.Parent.Left + (sChart1Left - sChart2Left)
If sChart1Left < sChart2Left Then
xChart2.Parent.Left = xChart2.Parent.Left - (sChart2Left - sChart1Left)
End If
End If
Exit Sub

gErrorProcedure = "Lineup_Charts"
DoCmd.OpenForm "GenericErrorForm"
Resume Lineup_Charts_Exit

End Sub

I saw a Post on another site where the author solved the problem in Excel. In that post the answer was turning on ScreenUpdating in Excel. Now as far as I know there isn't a setting for this in Powerpoint. Does anyone have any suggestions on how I could work around this issue? Thanks for the Help!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Method 'Range' of _Global' Failed accessing Excel Socko Beginning VB 6 0 January 29th, 2008 09:33 AM
Method reffering to an object beccali JSP Basics 1 March 23rd, 2007 07:24 AM
Method 'Open' of object '_Recordset' failed trom2004 Access VBA 7 December 14th, 2006 01:30 AM
login Failed on my report using PUSH Method melvik Crystal Reports 1 November 9th, 2006 08:35 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.