Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem placing embedded charts

A simple problem that hopefully someone can help me with:

I am trying to write a macro that will create several charts from data on
one sheet and place the charts into another sheet. I have two problems:

1. When creating the charts, passing various width parameters is producing
strange results. Namely, I create the first chart in one sub with something
that looks like this:

Sheets(Sheet1).ChartObjects.Add Left:=200, Top:=50, Width:=400, Height:=250
[code setting all the chart parametersseems to be working fine]
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet3"

Next, I want to create another chart with the same dimensions as the one
above but with different data. I would have expected that I could use the
same Width and Height parameters to ChartObjects.Add as above, but through
trial and error I have found I need to use the following:

Sheets(Sheet1).ChartObjects.Add Left:=620, Top:=50, Width:=150, Height:=250
[code setting all the chart parametersseems to be working fine]
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet3"

This creates two charts side by side with about the same dimensions. The
question, then, is why the two different width parameters create the same
approximate result.

2. Even when using these parameters determined through trial and error, I
get unexpected results. When I run the two procedures independently or
together they produce output as expected. When, however, I run them followed
by two more procedures that essentially do the same thing, but with different
data and with the resulting charts going to a different sheet, the two charts
created using the code above wind up directly on top of each other, and the
two charts created with otherwise identical code wind up swapping places
(i.e. the chart with the left parameter of 620 winds up on the left of the
chart with the left parameter of 200).

I know Im doing something wrong, but I dont know what. Any help would be
appreciated.

One final question: How do I zoom the viewable area so that, once created
and placed into the right position, the charts are fully visible, regardless
of how the user has the zoom set prior to macro execution?

Thanks

Chris

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
Placing shapes exactly on charts. Taylor Charts and Charting in Excel 7 August 17th 08 10:19 AM
Placing charts Fabrizio Excel Programming 3 June 29th 06 12:41 PM
embedded charts Steve Root Charts and Charting in Excel 0 May 30th 06 03:38 PM
placing an embedded file on a sheet in a fixed position [email protected][_3_] Excel Programming 3 April 24th 06 02:45 PM
Range reference problem placing charts Henri Excel Programming 3 April 16th 06 06:34 PM


All times are GMT +1. The time now is 06:43 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"