• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

How to create a Gif or Jpg image of a Chart taken from an Excel sheet|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / How to create a Gif or Jpg image of a Chart taken from an Excel sheet|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosHow to create a Gif or Jpg image of…
sp_PrintTopic sp_TopicIcon
How to create a Gif or Jpg image of a Chart taken from an Excel sheet
Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
1
November 7, 2018 - 9:08 pm
sp_Permalink sp_Print

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

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
2
November 8, 2018 - 2:04 pm
sp_Permalink sp_Print

Hi Maurizio

Please refer attached.

I have disabled your ON ERROR RESUME NEXT that ignores error (should be avoided).

Hope this helps.

Sunny

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
3
November 8, 2018 - 8:41 pm
sp_Permalink sp_Print

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

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1517
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
4
November 9, 2018 - 2:13 pm
sp_Permalink sp_Print

Hi Maurizio,

ActiveChart refers to the currently selected chart, see this

https://docs.microsoft.com/en-.....ctivechart

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.

Cheers

Phil

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
5
November 10, 2018 - 1:24 am
sp_Permalink sp_Print

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

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Sherry Fox, Richard West, Dana Friedt, Nada Perovic
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
terimeri dooriyan
Jack Aston
AndyC
Denise Lloyd
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Sopi Yuniarti
LAFONSO HERNANDEZ
Forum Stats:
Groups: 3
Forums: 24
Topics: 6218
Posts: 27265

 

Member Stats:
Guest Posters: 49
Members: 31901
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.