Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Determining if ChartObject is in PrintArea on Worksheet

Based on the way this is used, it's not a problem. I was trying to use an
Excel function within powerpoint and it kept kicking me out until I figured
that out.
Thanks,
Barb Reinhardt




"Andy Pope" wrote:

Hi,

What exactly do you want the function to do?

Currently it checks all the chartobjects on a sheet to see if the
topleftcell they cover is within the print area.
As soon as a chart meets that requirement the loop terminates. This could
lead to incorrect results.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in message
...
I'm trying to determine if a ChartObject is within the Print_Area on a
given
worksheet and have this code. I've noted in the code where execution
ends.
I've done a "debug.print" and see that the topleftcell is in the
Print_area,
but I'm not sure why it's quitting on me. Does anyone have any ideas?


Dim ChtObj As Excel.ChartObject
Dim myRange As Range

myChartInRange = False


On Error Resume Next
Set myRange = myWS.Range("Print_Area")
On Error GoTo 0
If myRange Is Nothing Then Exit Sub

For Each ChtObj In myWS.ChartObjects
myChartInRange = False
'Execution in this sub ends on the line below
If Not Intersect(ChtObj.TopLeftCell, myRange) Is Nothing Then
Debug.Print "Top Left in Range", myWS.Name, ChtObj.Name
Set myChtObj = ChtObj
myChartInRange = True
Exit For
End If
Next ChtObj
Debug.Print
--
HTH,
Barb Reinhardt



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Test whether a chartobject is on a worksheet Werner Rohrmoser Excel Programming 5 April 8th 08 11:59 AM
How to find existing ChartObject in a worksheet? itdept Excel Programming 1 February 8th 07 03:09 PM
Determining Worksheet Edit Mode Kevin Excel Programming 3 February 8th 06 08:59 PM
Determining if a Worksheet Exists Chaplain Doug Excel Programming 3 April 7th 05 10:00 PM
Determining selected worksheet Bob Conar Excel Programming 3 October 20th 03 01:51 AM


All times are GMT +1. The time now is 11:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"