Excel Macro is using an old chart but I want it to use the new one

misterno

Board Regular
Joined
Mar 16, 2009
Messages
78
It has been a week that my macro is using a chart that I saved last week

But the macro supposed to use the one that is coded. when I open the link that is coded it has the correct (new) chart

So why is my macro still using the old chart and how come it is using and old one althoug the coded one seems new.

I am confused, is this a cache problem? How do I clear that?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
It would help if we could see your code


here you go

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


Sub SaveDailyGraphs()
Workbooks.Open Filename:= _
"M:\Dept\SLNGNA\Gas LPM\Structuring\Price Curves\Commercial Curves\GSGNA Commercial Curves Indication\Daily Template\AGT_TM3 evolvement.xlsm", UpdateLinks:=0
Sheets("AGT-TM3").Select
ActiveWindow.ScrollColumn = 23
ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Year]").VisibleItemsList = _
Array("[Prices ObservationDate].[Observation Period].[Year].&[2009]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2010]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2012]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2013]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2014]")
ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Month]").VisibleItemsList = _
Array("")
Sheets("NBP").Select
ActiveWindow.SmallScroll Down:=-33
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Year]").VisibleItemsList = _
Array("[Prices ObservationDate].[Observation Period].[Year].&[2012]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2013]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2014]")
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Month]").VisibleItemsList = _
Array("", "", "", "", "", "", "", "", "", "", "", "", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[10]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[11]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[12]", "", "", "", _
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "")
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Date]").VisibleItemsList = _
Array( _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-20]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-21]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-22]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-23]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-24]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-25]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-26]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-27]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-28]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-29]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-30]" _
, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "")
Sheets("NBP2").Select
ActiveWindow.SmallScroll Down:=-33
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Year]").VisibleItemsList = _
Array("[Prices ObservationDate].[Observation Period].[Year].&[2012]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2013]")
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Month]").VisibleItemsList = _
Array("", "", "", "", "", "", "", "", "", "", "", "", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[10]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[11]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[12]", "", "", "", _
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "")
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Date]").VisibleItemsList = _
Array( _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-20]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-21]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-22]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-23]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-24]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-25]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-26]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-27]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-28]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-29]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-30]" _
, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "")
Sheets("Brent").Select
ActiveWindow.SmallScroll Down:=-33
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Year]").VisibleItemsList = _
Array("[Prices ObservationDate].[Observation Period].[Year].&[2012]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2014]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2013]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2009]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2010]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011]")
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Month]").VisibleItemsList = _
Array("", "", "", "", "", "", "", "", "", "", "", "")
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Date]").VisibleItemsList = _
Array("")
Sheets("Kiodex TM3").Select
ActiveWindow.SmallScroll Down:=-15
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Year]").VisibleItemsList = _
Array("[Prices ObservationDate].[Observation Period].[Year].&[2012]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2014]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2013]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2009]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2010]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011]")
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Month]").VisibleItemsList = _
Array("", "", "", "", "", "", "", "", "", "", "", "")
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Date]").VisibleItemsList = _
Array("")
Sheets("Henry").Select
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Year]").VisibleItemsList = _
Array("[Prices ObservationDate].[Observation Period].[Year].&[2012]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2014]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2013]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2009]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2010]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011]")
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Month]").VisibleItemsList = _
Array("", "", "", "", "", "", "", "", "", "", "", "")
ActiveSheet.PivotTables("PivotTable3").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Date]").VisibleItemsList = _
Array("")
Sheets("GBP").Select
ActiveSheet.PivotTables("PivotTable4").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Year]").VisibleItemsList = _
Array("[Prices ObservationDate].[Observation Period].[Year].&[2012]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2013]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2014]")
ActiveSheet.PivotTables("PivotTable4").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Month]").VisibleItemsList = _
Array("", "", "", "", "", "", "", "", "", "", "", "", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[10]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[11]", _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[12]")
ActiveSheet.PivotTables("PivotTable4").PivotFields( _
"[Prices ObservationDate].[Observation Period].[Date]").VisibleItemsList = _
Array( _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-20]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-21]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-22]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-23]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-24]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-25]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-26]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-27]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-28]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-29]" _
, _
"[Prices ObservationDate].[Observation Period].[Year].&[2011].&[9].&[2011-09-30]" _
)
ActiveWorkbook.RefreshAll
Calculate
Dim ws As Worksheet
rootDir = "M:\dept\SLNGNA\Gas LPM\Structuring\Price Curves\Commercial Curves\GSGNA Commercial Curves Indication\Daily Graphs"
Set ws = ActiveWorkbook.Sheets("AGT-TM3")
ws.ChartObjects(1).Chart.Export rootDir & "\AGT & TM3" & ".jpg", "JPG"
Set ws = ActiveWorkbook.Sheets("NBP")
ws.ChartObjects(1).Chart.Export rootDir & "\NBP" & ".jpg", "JPG"
Set ws = ActiveWorkbook.Sheets("NBP")
ws.ChartObjects(2).Chart.Export rootDir & "\NBP1" & ".jpg", "JPG"
Set ws = ActiveWorkbook.Sheets("NBP2")
ws.ChartObjects(1).Chart.Export rootDir & "\NBP2" & ".jpg", "JPG"
Set ws = ActiveWorkbook.Sheets("Brent")
ws.ChartObjects(1).Chart.Export rootDir & "\Brent_year" & ".jpg", "JPG"
Set ws = ActiveWorkbook.Sheets("GBP")
ws.ChartObjects(1).Chart.Export rootDir & "\GBP" & ".jpg", "JPG"
Workbooks.Open Filename:= _
"M:\Dept\SLNGNA\Gas LPM\Structuring\Price Curves\Commercial Curves\GSGNA Commercial Curves Indication\Daily Template\WebICEdump_v4.1.xlsm", UpdateLinks:=0
Sheets("View").Select
Range("A2:B2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("AGT_TM3 evolvement.xlsm").Activate
Sheets("JKM").Select
Range("A2:B2").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Set ws = ActiveWorkbook.Sheets("JKM")
ws.ChartObjects(1).Chart.Export rootDir & "\JKM_year" & ".jpg", "JPG"
ActiveWorkbook.Save
ActiveWorkbook.Close
Windows("WebICEdump_v4.1.xlsm").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
 
Upvote 0
Have you tried stepping thru your code using the F8 key to identify where it is going wrong?
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top