June 26, 2016
Hello everyone I'm new Maurizio me the usual break with many ideas and few skills to put them into practice.
My new problem is this:
Some time ago I tried to create a function that could copy a chart created on a sheet of excel.
And send it on my Deshtop I have Workbook that is in Format (Gif or Jpg)
Ahora how how procedure seems to work because it does not give me various errors.
But there must be something wrong somewhere that does not transfer anything to me.
I have better say: I sent it only once when the listing was still in the Embryonic phase; But then at Routine completed no more done anything because?
You kindly know how to give me a hand, thank you?
Sincere greetings from A.Maurizio
June 25, 2016
June 26, 2016
Hello SunnyKow thank you so much you're a great guy
Try it and it works great.
In practice what did not go was just the fact that I had written the Formula
1) (If ActiveChart Is Nothing Then) you have changed it with
2) (If objChart Is Nothing Then)
But at this point can I still ask you to explain what changes between the two functions?
Thank you so much Greetings from A.Maurizio
October 5, 2010
ActiveChart refers to the currently selected chart, see this
If you select a chart before running the macro, you can just use ActiveChart and don't need to use another object e.g. objChart
This works fine if you click on a chart and then run the macro from the VBA editor, but if you click on a chart and then click a shape to run your macro, it fails.
This is because clicking the shape makes the shape active, not the chart, even though the chart appears to be active as it appears to be still selected.
This behaviour is not really what I'd expect/hope for, though I understand why it's happening. It's the same problem if you try to run the macro using a text box, smart art, or a picture.
But, if you add an icon to your Quick Access Toolbar, you can run the macro that way. Or you can use a shortcut key sequence.
Either of these ways allows you to just click a chart and then run your macro. You can now simplify the code a bit only requiring one check to see if a chart is selected.
Another thing to consider is that if you use Set objChart = ActiveSheet.ChartObjects(1) you only ever get the first chart on the sheet. But if there's more than one, how do you export the others? So using ActiveChart when you have more than one chart gets past this issue.
Please see attached workbook.
June 26, 2016
Hi Philip Treacy
As always Google Traslator is not the best to make those who speak English speak little.
But reading everything I understood what you wanted to say; So I thank you for your suggestion and your file that you have attached.
Surely in the future I will make good use of it, For the rest what to say Thank you Infinite Sincere greetings to all of you; You are fantastic as always everyone.
Hello and next to A.Maurizio