Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
<<ark is a string variable containing the sheet name. This is part of a sub,
accepting different sheet names. Ah ha. I didn't think about the fact that you might be using a variable. Normally, you are supposed to use object variables to point to the object. If the worksheet being referenced by the code is not the active worksheet, then these types of problems result. So, at the top of your code, you should add variables to reference the worksheet and chart, then set them to the worksheet and chart, like so: Dim ws as Worksheet Dim crt as ChartObject 'Other variable declarations. Set ws = Worksheets(ark) Set crt = ws.ChartObjects("Chart 1") With crt.Chart.PlotArea 'Code to set and check PlotArea properties. End With I had these problems a lot also in the early days of learning Excel VBA macro programming. (Time to buy a couple of books or visit the http://www.mvps.org/links.html#Excel page and see what they might have.) -- Hope this helps (HTH), Regards, Bill |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem with excel macro - getting automation error | Charts and Charting in Excel | |||
Excel 2003 c++ automation problem. | Excel Worksheet Functions | |||
Excel Automation Problem with Late Binding | Excel Programming | |||
TypeConverter Excel-Automation problem | Excel Programming | |||
Problem with quitting Excel opened through automation | Excel Programming |