ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with copying chart using VBA (https://www.excelbanter.com/excel-programming/306416-problem-copying-chart-using-vba.html)

charles[_2_]

Problem with copying chart using VBA
 
Hi,

I'm copying a chart sheet from one workbook (an add-in) to another
workbook, but the chart in the new workbook looks slightly different:

1) The axis titles are missing.
2) I have a lot of text boxes on the chart, now they all moved.

I used the following code in the new workbook to copy the sheet:

Sub Plot()
If SheetExists("Diagram") = False Then
Workbooks("All-data.xla").Worksheets("Diagram").Copy
Befo=ActiveSheet
End If
PlotNewDiagram 'adding more curves to the existing chart
End Sub

What have gone wrong? How can I prevent the above? I can fix problem
#(1) by re-defining the axis titles in the code, but I really don't
know how to deal with with the relocated text boxes. Those texts were
used to annotate existing curves on the chart. With their locations
changed, they no longer make senses.

I'm grateful for any suggestions!

Charles

Bob Flanagan

Problem with copying chart using VBA
 
Charles, you may want to check to see if the zoom setting on your add-in
worksheet is 100% (You'll have to change the workbook add-in property to
false temporarily). I have found that if it is not set to 100%, copying
charts sometimes ends up with strange results. I have not had it affect the
axis titles.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel



"charles" wrote in message
om...
Hi,

I'm copying a chart sheet from one workbook (an add-in) to another
workbook, but the chart in the new workbook looks slightly different:

1) The axis titles are missing.
2) I have a lot of text boxes on the chart, now they all moved.

I used the following code in the new workbook to copy the sheet:

Sub Plot()
If SheetExists("Diagram") = False Then
Workbooks("All-data.xla").Worksheets("Diagram").Copy
Befo=ActiveSheet
End If
PlotNewDiagram 'adding more curves to the existing chart
End Sub

What have gone wrong? How can I prevent the above? I can fix problem
#(1) by re-defining the axis titles in the code, but I really don't
know how to deal with with the relocated text boxes. Those texts were
used to annotate existing curves on the chart. With their locations
changed, they no longer make senses.

I'm grateful for any suggestions!

Charles





All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com