Consulting

Results 1 to 2 of 2

Thread: Excel 2016 .CopyPicture

  1. #1
    VBAX Regular
    Joined
    Jun 2008
    Posts
    72
    Location

    Excel 2016 .CopyPicture

    Hello. We have an existing macro that has run successfully for years on Excel 2010. The macro creates charts, copies pictures of the charts to another tab.

    We upgraded to Excel 2016 last week. And the following line of code now works incorrectly. It only copies part of the range.
    rRange_To_Copy.CopyPicture xlScreen, xlPicture
    Has anyone else experienced this? Is there a work around?

    Thanks!

  2. #2
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    6,392
    Location
    Not sure I completely understand, but this works in 2016



    Option Explicit
    
    Sub test()
        Dim rRange_To_Copy As Range
        
        Set rRange_To_Copy = ActiveSheet.Range("A1:C3")
        rRange_To_Copy.CopyPicture xlScreen, xlPicture
        
        Worksheets("Sheet2").Select
        Range("D4").Select
        ActiveSheet.PasteSpecial Format:="Picture (Enhanced Metafile)", Link:=False, DisplayAsIcon:=False
    
    End Sub
    Attached Files Attached Files
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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