+ Reply to Thread
Results 1 to 19 of 19

Excel 2003 / 2010 compatibility

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Excel 2003 / 2010 compatibility

    Hi!
    I have worked out a code which is able to take a picture of a chart with a table below and export it as a picture! However, it only works on Excel 2003.... In Excel 2010 it doesn't work... :-(
    I get this error on "Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap":
    Run-time error '1004'
    Application-defined or object-defined error

    Any help is very much appreciated!!
    Best regards
    Last edited by asgersax; 11-22-2012 at 04:13 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel 2003 / 2010 compatibility

    is the table part of the chart or a range below it? the code ought to work as far as I can tell
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    Hi.
    Thanks for the reply.
    The table is not part of the chart, so I'm selecting a range including a chart AND the tables below.

    The code looks like this:

    Please Login or Register  to view this content.
    Best regards,
    Last edited by arlu1201; 11-22-2012 at 05:35 AM.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Excel 2003 / 2010 compatibility

    asgersax,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel 2003 / 2010 compatibility

    the code is fine since it works in 2010 for me. can you post the workbook-just that sheet and the code necessary

  6. #6
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    Hi.
    Tested my sheet again, fortunately I haven't been able to figure it out yet...
    I have made a test copy, the charts are now pictures but it still doesn't work with the same error as described above...
    Any help will be highly appreciated!! Please see the attached test sheet
    Best regards
    Attached Files Attached Files

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel 2003 / 2010 compatibility

    that workbook works fine here-are you using 32bit or 64bit excel?

  8. #8
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    The Microsoft Office folder is located in Program Files (x86) which means 64 bit right?

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel 2003 / 2010 compatibility

    64 bit windows but 32bit excel

    does the problem remain if you use
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    Yes that seems to solve the problem!! :-)
    However.... Now I get a bug on pasting the last picture... Also the first chart created doesn't get deleted as I would think my code states...?
    I get the follow error:
    "Application-defined or object-defined error" on the last paste call "ch.Chart.Paste"!
    Any ideas?

  11. #11
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    Hi again...
    Problem almost solved...
    It seems to be that if I zoom out (so that I can see all 3 graphs on my screen) then I don't get any error... But then the images exported also get a low resolution! So how can I get around this?
    Perhabs incorporate a zoom and scroll in my vba code...?
    Or is the problem something todo with the clipboard being full when it is about to copy/paste the final graph like out of memory..?

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel 2003 / 2010 compatibility

    which line of code did you use in the end?

  13. #13
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    I tried them all but ended up using

    Please Login or Register  to view this content.
    The others also work but I don't that's the issue?

  14. #14
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel 2003 / 2010 compatibility

    isn't that the line you had originally that didn't work?

  15. #15
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    Yes, that's right. However I used the
    Please Login or Register  to view this content.
    on the last graph initially causing the problem... and then I experienced the new problem (using Excel 2010) with selecting the graph when I didn't zoom out (so that all graphs / the ranges are visible) which again causes a too low resolution...
    Any ideas? :-)
    Best regards

  16. #16
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    I have not tried to use
    Please Login or Register  to view this content.
    and I'm pretty sure it is some kind of zoom issue when I paste and export the image... Any ideas?

  17. #17
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    But also weird that the image resolution gets smaller and smaller from the firste image captured to the last one!

  18. #18
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel 2003 / 2010 compatibility

    does this work any better?
    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    10-11-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel 2003 / 2010 compatibility

    Hi Again.
    I found a way to avoid the problem by inserting "On Error Resume Next"...
    Not the best solution in any way but it works!
    But thanks for your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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