+ Reply to Thread
Results 1 to 10 of 10

copy chart from excel to word

  1. #1
    Registered User
    Join Date
    05-14-2015
    Location
    kl
    MS-Off Ver
    2010
    Posts
    19

    copy chart from excel to word

    Hi guys...i'm quite new to macro programming and need some help here. I have created a macro button on my spreadsheet to copy all the charts in my spreadsheet to a new microsoft word file.

    the problem i have is when the charts are copied to the microsoft word file, all the charts are "joined" together as a single image. how do i paste those charts as individual image on microsoft word?

    and also, let say if i have 1 of the charts on my spreadsheet which have no trendline/data, i don't want it to be pasted on the microsoft word. how do i do it?(meaning if i click on the macro button, only charts with trendline will be copied to the microsoft word)

    below are my code..and also the sample excel file

    Please Login or Register  to view this content.
    haaa.xlsm

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: copy chart from excel to word

    As for first part of question:

    Please Login or Register  to view this content.
    The second is less obvious - in attached file there is no such chart. Assuming you really ment trendline you may use:

    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    05-14-2015
    Location
    kl
    MS-Off Ver
    2010
    Posts
    19

    Re: copy chart from excel to word

    Quote Originally Posted by Kaper View Post
    As for first part of question:

    Please Login or Register  to view this content.
    The second is less obvious - in attached file there is no such chart. Assuming you really ment trendline you may use:

    Please Login or Register  to view this content.
    Thanks so much for the help Kaper. The first script works like charm!

    However for the 2nd script, when i tried to run it, it only opens the microsoft word file & nothing happened. i tried to remove the data on the 2nd chart (the "score" chart) and click on the button, but nothing happen as well.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: copy chart from excel to word

    As I wrote - in attached file there was no chart with trendline.To create trendline you need scatterplot.

  5. #5
    Registered User
    Join Date
    05-14-2015
    Location
    kl
    MS-Off Ver
    2010
    Posts
    19

    Re: copy chart from excel to word

    Quote Originally Posted by Kaper View Post
    As I wrote - in attached file there was no chart with trendline.To create trendline you need scatterplot.
    ooh...i finally got what you mean now...

    sorry, my bad ..i guess i didn't explain it clearly in my first post. i shoudn't use the word "trendline" ...perhaps should be "line" instead?..let me rephrase my sentence again..

    for example, in my attached spreadsheet, there are 2 charts (Age & Score), lets say if the "Age" chart is showing the line and the "Score" chart doesn't show the line (as shown in the image below). If i click on the macro button, only the "Age" chart should be copied to microsoft word.

    noScore.jpg


    (i tried adding trendline to my chart and your 2nd script works . Exactly the concept i wanted, but how do i modify the script to capture "line" or "bar" etc instead of "trendline" ?)
    Last edited by wongth7; 06-04-2015 at 03:40 AM.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: copy chart from excel to word

    But here is no line because of just no data. If it is the case, then:
    Please Login or Register  to view this content.
    will do.

    If the cells are not really empty, but there are formulas returnumg "" (so they just look like empty) change inner loop to:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-14-2015
    Location
    kl
    MS-Off Ver
    2010
    Posts
    19

    Re: copy chart from excel to word

    Thanks again Kaper...really appreciate your help..problem solved

  8. #8
    Registered User
    Join Date
    05-14-2015
    Location
    kl
    MS-Off Ver
    2010
    Posts
    19

    Re: copy chart from excel to word

    Hi Kaper, i realised that if the data & the charts are on the sheet, the script works fine..however, when the charts & data are on different sheet, the script wont work..is there any solution for that?

    i'm using the below script...


    Please Login or Register  to view this content.

  9. #9
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: copy chart from excel to word

    Sheet name shall be also found, for instance:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-14-2015
    Location
    kl
    MS-Off Ver
    2010
    Posts
    19

    Re: copy chart from excel to word

    ok...tested...working fine

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy Chart from Excel to Word
    By Elena Barkovskaya in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 05-15-2013, 04:46 AM
  2. How to copy an excel pivot chart into word?
    By gilbeiry in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-29-2013, 11:23 AM
  3. How to copy an excel pivot chart into word?
    By andybenjami in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-05-2013, 04:48 AM
  4. [SOLVED] Copy Chart from Excel to Word using VBA
    By Jonathan Allen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2006, 04:10 PM
  5. [SOLVED] Copy Chart from Excel to Word
    By Jonathan Allen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2006, 09:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1