unable to get the chartobjects property of the worksheet class

Hi everyone,

I am very new to EXCEL, please refer to the macro and help 
if you can.

My question is I got an error message "unable to get the 
chartobjects property of the worksheet class" at the codes 
( ActiveSheet.ChartObjects("Chart 3").Activate).

This recorded macro is just select a range then make a 
chart out of it.  Then cut and paste the chart to another 
area on the same sheet.  I think the error message came 
when I select and cut the graph.

I stuck at I don't know how to get the program return the 
chartobject property so that I can assign the name to 
chartobject.

-----------------

 Range("A1:D15").Select
    Charts.Add
    ActiveChart.ChartType = xlLineMarkers
    ActiveChart.SetSourceData Source:=Sheets
("Query4").Range("A1:D15")
    ActiveChart.Location Where:=xlLocationAsObject, 
Name:="Query4"
    ActiveWindow.Visible = False
    ActiveWindow.WindowState = xlNormal
    ActiveWindow.WindowState = xlMaximized
    'error=> ActiveSheet.ChartObjects("Chart 3").Activate
    Range("G2").Select
    ActiveChart.Paste
    ActiveWindow.Visible = False
    Windows("macrotesting2.xls").Activate
    Range("A1:D15").Select
    Selection.Cut
    Range("H23").Select
    ActiveSheet.Paste
    Range("L24").Select
-----------------------------

Thank you very much!
rita


0
anonymous (74722)
2/25/2004 4:58:42 PM
excel.charting 18370 articles. 0 followers. Follow

1 Replies
1152 Views

Similar Articles

[PageSpeed] 38

Hi Rita -

The problem with a recorded macro is that it does exactly what you told 
it to do the first time, then you need to make adjustments for future 
use. Perhaps you no longer have "Chart 3", or you're using the macro on 
a sheet without as many charts.

If it's the same chart as you created earlier in the code, you could 
instead use a sequence like this, which uses a chartobject variable, and 
creates the chart directly in the worksheet. You can then use the 
variable later to refer to the same chart, without worrying how Excel 
may have named it.

Sub AddChartObject()
Dim myChtObj As ChartObject
'
     Set myChtObj = ActiveSheet.ChartObjects.Add _
         (Left:=100, Width:=375, Top:=75, Height:=225)
     myChtObj.Chart.ChartType = xlXYScatterLines
     myChtObj.Chart.SetSourceData Source:=Sheets("Sheet1").Range("A3:G14")
End Sub

This is an excerpt from my page:

   http://peltiertech.com/Excel/ChartsHowTo/QuickChartVBA.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______

rita wrote:

> Hi everyone,
> 
> I am very new to EXCEL, please refer to the macro and help 
> if you can.
> 
> My question is I got an error message "unable to get the 
> chartobjects property of the worksheet class" at the codes 
> ( ActiveSheet.ChartObjects("Chart 3").Activate).
> 
> This recorded macro is just select a range then make a 
> chart out of it.  Then cut and paste the chart to another 
> area on the same sheet.  I think the error message came 
> when I select and cut the graph.
> 
> I stuck at I don't know how to get the program return the 
> chartobject property so that I can assign the name to 
> chartobject.
> 
> -----------------
> 
>  Range("A1:D15").Select
>     Charts.Add
>     ActiveChart.ChartType = xlLineMarkers
>     ActiveChart.SetSourceData Source:=Sheets
> ("Query4").Range("A1:D15")
>     ActiveChart.Location Where:=xlLocationAsObject, 
> Name:="Query4"
>     ActiveWindow.Visible = False
>     ActiveWindow.WindowState = xlNormal
>     ActiveWindow.WindowState = xlMaximized
>     'error=> ActiveSheet.ChartObjects("Chart 3").Activate
>     Range("G2").Select
>     ActiveChart.Paste
>     ActiveWindow.Visible = False
>     Windows("macrotesting2.xls").Activate
>     Range("A1:D15").Select
>     Selection.Cut
>     Range("H23").Select
>     ActiveSheet.Paste
>     Range("L24").Select
> -----------------------------
> 
> Thank you very much!
> rita
> 
> 

0
jonNO1 (306)
2/28/2004 3:33:09 AM
Reply:

Similar Artilces:

How do I add rows and headers to several worksheets automatically
I have several worksheets that have the same rows and headers but different data and I'll need to add new rows with headers as new projects start. Is there a way to do this automatically without having to manually add rows and headers to each sheet? You can select multiple sheets at once and now changes are being made to all of the selected sheets at once. To select multiple sheets Select the first sheet Now hold down the Ctrl key and select more sheet. The tab on each sheet you select will highlight. You can also hold down the Shift key to select all sheet from the first ...

Excel format doesn't show in worksheet
I've used previous versions of excel for years- and have always found the color fill and font colors I selected for cells would show up right in the active spreadsheet. In my version of Small Business 2003 it is only showing up in the preview mode. We have another computer with Small Business 2003, and it is working fine, it still shows up in the worksheet... Any idea what settings are amiss on mine? ...

How do I get MSWord for Mac to keep its toolbars?
Each time I open MSWord for Mac 2008 I have to re-configure to view the standard and formatting toolbars. Then when I start a "new blank document", those toolbars have gone and I have to go to "View>Toolbars>Formatting" and see it is already ticked. So I have to un-tick it and then re-tick it before it re-appears. And then I have to do the same for the standard toolbar. Anyone have any ideas? ...

select worksheets are corrupting/freezing
Background situation: I am working with a file that contains around 15 PivotTables, all linked to the same cache. The problem: For about a week I have been having trouble with a few of the worksheets - about 3 different tabs, each contains a chart. The file opens fine, no error messages, but when I click on one of the problematic worksheets and then try to change anything on it - close the field list, move the chart, or even select and move to a different worksheet, Excel begins to freeze, and portions of the screen are frozen to the image of the problematic worksheet. I even tried moving...

Applying same macro to all worksheets in workbook
HI, I am trying to find an easy way to apply a macro that changes the absolute value of a couple of cells and changes some plot formatting to all sheets in a workbook. All sheets are the same and need the same macro applied to them, I have recorded the macro such that I can click on a worksheet and hit a keyboard command to execute this, but I have to individually select each worksheet and repeat this throughout, how can this be automated? Thanks, Josh Rewrite the macro so it takes a worksheet as an argument. Then write a second macro that iterates your worksheets and passes them one at...

How do I get our Outlook accts to accept emails froma specific dom
I know how to "Accept this domain" in each individual Outlook accout, however, when we add new Outlook accounts we have to go through the process each time. Someone in the office suggested getting a list of all of the emails from that domain and then updating the server. Would this be the best way to do this? Is there a way to get the main Outlook account to accept the domain name and then each time that we add a new account it will automatically accept emails from this domain? What version of Outlook? Do you have the junk mail setting refusing all mail except f...

I can't select all my worksheets in Excel
I am unable to select all of my worksheets in my workbook. I know of all the different ways to do it, but is there a setting somewhere that would prevent me from selecting my sheet tabs...other than a protected worksheet? Not that I can think of. And even if the worksheet were protected, you should be able to select any sheet (or group any sheets). Dan Connors wrote: > > I am unable to select all of my worksheets in my workbook. I know of all the > different ways to do it, but is there a setting somewhere that would prevent > me from selecting my sheet tabs...other than a pr...

Cannot get emails back from Deleted Items folder
Outlook 2003 After deleting an email, I normally can move the email from the Deleted Items folder back to my Inbox. Or after deleting, I can Undo and it restores the email back to its original folder. Now, for some unknown reason, the Deleted Items folder will not let go of emails. I tried moving, clicking and dragging, and undoing, but they are stuck in the Deleted Items folder. All I can do to survive is copy them back. Any solution to this? how 'full' is the deleted folder and the folder you want to move them back into? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself ...

Protecting a worksheet question
I have a question for Excel 98. I tried to do a simple worksheet protection and provided a password. However, I found that not ALL cell in that particular worksheet was protected. Most of the cell would give you a message telling you the worksheet is protected and you need to unprotect the worksheet to modify the cell content. However, some cells you can still change its content. What are the reasons these things happen? Thank you! Each cell has a locked property that you can toggle. But the "lockedness" doesn't really do anything until the worksheet is protected. Then l...

how to get internal email in the queue ?
Hi, I know that an internal email that is forwarded to an emailaddress that is setup as a queue will not arrive in ms crm, but I need to have a workaround for this. Any sugguestions ? I assume it must be possible to get around this. Please help. Regards Wim Wim - I've been able to set up a free forwarding account outside the domain - something like mydomain_helpdesk@yahoo.com - and set up that external account to automatically forward all email back into my helpdesk address - helpdesk@mydomain.com (which is associated with the CRM Queue) - So, instead of emailing the CRM Queue dire...

401 Worksheet
I tried runing a backdated 401 worksheet to recapture some lost data in HQ from the stores. I needed to go back several years. It was painfully slow and then it froze. Does anyone have suggestions on a better way to syncronize the store data to HQ. I read somewhere that before you run a 401 of such magnitude you should turn off the downloading of journals .. should speed things up for you. Also, suggest you run at the LAST connection of the night so that it has time to finish before another connection occurs. Scott "MAS" wrote: > I tried runing a backdated 401 worksh...

how do I set up an annual calendar on one worksheet
I need a tempplate to set up on one worksheet an annual calendar with days of the week, months and date numbers. I havae to set up a calendar that has recurring dates e.g. evry 3rd Weds in Feb, 4th Tues in may etc ANy help would be appreciated on all or some of the above start here: http://office.microsoft.com/en-us/results.aspx?Scope=TC&Query=calendar -- Gary''s Student "Ian Dee" wrote: > I need a tempplate to set up on one worksheet an annual calendar with days of > the week, months and date numbers. > I havae to set up a calendar that has recurring ...

chime when Outlook gets mail
Is there a way up change the sound? I'm on Outlook 2000 SP-3 9.0 with an XP machine and the sound is so subtle that I miss it sometimes. When i was on 98, it was a fairly clear two-pitch tone. ...

Strage function in worksheet {=TABLE(I64,)}
I am attempting to understand what appears to be a custom function in a workbook I was given, author unknown. It seems to be some type of index or look up but their is no help on it or macro defined for it. has anyone used or familiar with this? If you need more information I would be happy to provide it. {=TABLE(I64,)} Thanks, Mark On Thu, 26 Feb 2004 19:30:25 -0600, "mkadon" <mkadon@hotmail.com> wrote: >I am attempting to understand what appears to be a custom function in a >workbook I was given, author unknown. It seems to be some type of index or >look up...

custom color palette does not get transferred with the workbook. Excel 2003
Scenario:We use a custom color palette with predefined company colors, and excel 2003. Default workbook has also been modified to replicate colors to new workbooks - located at %userprofile%\Application Data\Microsoft\Excel\XLSTART\workbook.xls NOw the problem: When users create a workbook based in the default and email it to outside users who does not have the custom color palette defined as default, the colors change - custom palette disappears and workbook shows excel default colors,sometimes making the document very difficult to read. Also, if we email the document back to the origina...

Unable to create custom keyboard shortcut
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) I get to where you are able to create a custom keyboard shortcut. But when I select my command &quot;NextChangeorComment&quot; and select the &quot;Press new keyboard shortcut&quot; field, nothing happens. No text shows up in the field, nor does the &quot;Assign&quot; button become selectable. Since you don't specifically say that you did so, once you click in the field you need to press the actual key combination you want to assign to the command. If you did so but nothing displayed in the field it&#...

XslCompiledTransform Load method getting "Root element is missing" XSL Compile error...???
XslCompiledTransform xslt = new XslCompiledTransform(); ASCIIEncoding encodeToByteArray = new ASCIIEncoding(); MemoryStream inputStream = new MemoryStream(); MemoryStream outputStream = new MemoryStream(); MemoryStream xslStream = new MemoryStream(); String inputString = "<foo>Hello XSL</foo>"; byte[] inputArray = encodeToByteArray.GetBytes(inputString); //write the string buffer to the stream inputStream.Write(inputArray, 0, inputString.Length); Str...

Opening file from an item loses Word document properties
Hello, I have just discovered that when you double-click a Word file attached to an appointment item (although I imagine it will be the same for other items too), Outlook does not open the actual file, but takes a copy and puts it in the temp folder and opens that. This is a pain as it mucks up some of the automation coding I have done, but what's worse is that the copy doesn't seem to have the custom properties I have set. Is there any way of forcing Outlook to open the original, instead of a copy? Failing that, any ideas why the custom document property would have been lost...

Allow access to item properties when Adding Items to purchase orde
Allowing access to item properties when adding items to a purchase order would assist in updating information like aliases, etc. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx...

Not getting download of account transactions
I download my accounts from my bank's website and that ususally stores the transactions on Money (it has been spawned). As of yesterday when I try to download the transactions from bank's website I get nothing coming to my computer. I search of mny files but there is nothing. what is going on In microsoft.public.money, LC wrote: >I download my accounts from my bank's website and that >ususally stores the transactions on Money (it has been >spawned). As of yesterday when I try to download the >transactions from bank's website I get nothing coming to >m...

Unable to update Mailbox SD in the DS.
Hello Newsgroup, in the eventlog i have a entry from the source MSExchangeIS an the event id 9554. Unable to update Mailbox SD in the DS. Mailbox Guid: fdcbf7ce-9d05-4bac-aa37-9831c97729da. Error Code 0x8004010f i have read the ms Article ID : 322308 and Article ID : 555433 . i run adfind with the following Parameter. adfind -gc -b "" -binenc -f " msExchMailboxGUID={{GUID:fdcbf7ce-9d05-4bac-aa37-9831c97729da}}" -dn here the result H:\Exchange\Tools>adfind -gc -b "" -binenc -f " msExchMailboxGUID={{GUID:fdcbf7ce-9d05-4bac-aa37-983 1c97729da}}&qu...

date doesn't get entered in cell
I give up, why is the "inputDate" variable not getting put in the "v5" cell? In "a4" cell the "f_FnameLname" variable is getting entered just fine. Also, is there a way to format the date so that in the dialog box the user will have to enter a date? tia, Public Sub SingleMonths() 'months macro rewritten 'used for a single patient sheet to be printed Dim inputDate As Date Dim i As Long inputDate = InputBox("Enter a date:", "Date", Date) 'requires date input from the user in a dialog box For i = 2 To Worksheets.Count...

Property sheets and compstui
Hi, I have property sheet page dialog created using mfc. I want to plug in this mfc property sheets into the cpsui model so I can use this in printer drivers. The only way you can add property sheets in printer drivers is to use the cpsui with the CPSFUNC_ADD_PROPSHEETPAGE. for this I will have to fill in the PROPSHEETPAGE structure and pass to the compsui. Is there anyway I can plug in the user interface created using mfc into the compsui model? Thanks /j If I can fill in pfnDlgProc of the PROPSHEETPAGE structure, I should be able to get this working. How can I get pfnDlgProc me...

Exchange 2003: One user getting "No transport provider was available for delivery to this" several times a day
We run Exchange 2003 in a WIndows 2000 domain. Most of our clients (including the problem user) use citrix, so the setup for individuals has little variation on basics such as Outlook 2003. One user continually has problems sending out and several times a day (sometimes much more), she is prevented from sending emails with the error: The following recipient(s) could not be reached: John Doe on 20/09/2007 10:01 No transport provider was available for delivery to this recipient. I looked up the 'no transport' issue on Microsoft KB, and nothing was really applica...

How can I add a color object when I use the PieChartElement class
Hello! If I want to draw a pie with the data in the paremeterless Draw method below and I want to specify a specific color for each sector in the piechart how can that be done. There is no overloaded method in the PieChartElement class where I can add a color object. The other Draw method is an event handler for the Paint event for a PictureBox. The method called DrawPieChart is where the actual drawing take place. As you can see in this code I pass all the data except the color for each sector in the pie chart to method DrawPieChart but I want to also pass the color for eac...