Here is my code for the simplest of graph
Set Cht_dist555 = Charts.Add
With Cht_dist555
.ChartType = xlColumnStacked
.SetSourceData Source:=Range("dist_data"), PlotBy:=xlColumns
.Deselect
End With
When I save and reopen, it asks me about updating links. I delete the
chart, save and reopen: the update link message is gone.
I made no reference in my workbook whatsoever about the other workbook
including in the VBA reference.
So I changed the updatelinks to xlupdatelinksnever under the
"thisworkbook" property and it works.
What really bugs me is not understanding how this stupid little code
to create a chart links to another workbook.
Thoughts?
Just looking at your post, you have one named range called "dist_date"
but your code refers to a range called "dist_data". As these two
names vary you are asking alot of Excel. I would suggest you have a
named range in another workbooked called "dist_data".
If you mean the referenced area to be "dist_date" then change the
reference in your code and it will work ok.
Take care
Marcus
Hi Marcus. My named range is “dist_data”.
Typo on my part.
I just put your code into a blank and new workbook and ran it on some
dummy data. It worked well and saved OK. There were no links.
Open a blank workbook put some months and random numbers in adjacent
columns, name the range "Test" then run your attached code on it.
Save the file then reopen it. If it opens without the Links message
then you need to go back and look at both your code and named range.
Good luck
Marcus
Sub MakeChart()
Set Cht_dist555 = Charts.Add
With Cht_dist555
.ChartType = xlColumnStacked
.SetSourceData Source:=Range("Test"), PlotBy:=xlColumns
.Deselect
End With
End Sub