Results 1 to 3 of 3

Thread: Copying images in XLS 2010

  1. #1

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Question Copying images in XLS 2010

    I feel like a dinosaure... I just switched to coding VBA in Excel 2010 from 2003 and I found myself lost with some "simple" things. I would appreciate your help.

    Problem 1

    Originally, I had an Excel 2003 spreadsheet with some images, lines and textboxes that I copied and pasted in Powerpoint 2003. These objects were pasted in a newly created slide an they remained separate objects, i.e. images, lines and textboxes.

    I switched to Exel 2010 (still PowerPoint 2003) and I found that all the objects are grouped and pasted as a single image. I tried different PasteSpecial options with no sucess.

    Problem 2

    I have one sheet where there are many images, then I select some of them, and one by one I copy and paste them in another sheet.

    In Excel 2003 this works fast enough but in Excel 2010 it takes at leats 4 times longer.
    Last edited by Fonty; Feb 12th, 2012 at 01:00 PM.

  2. #2

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Re: Copying images in XLS 2010

    I think a solution to #1 is to select ranges all at once and paste them, like:

    Sheets(1).Shapes.Range(Array("img1","img2","img3")).Copy
    Sheets(2).Paste

    But I cannot automate it. For example, this won't work even if I have "the same" string:

    myStr=Chr(34) & "img1" & Chr(34) & "," & Chr(34) & "img2" & Chr(34) & "," & Chr(34) & "img3" & Chr(34)
    Sheets(1).Shapes.Range(Array(myStr)).Copy
    Sheets(2).Paste

    How can I do this?

  3. #3

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Re: Copying images in XLS 2010

    I'm still stucked with this... I thied the following without success:
    Code:
        Dim my_range As Variant
        Dim test() As String
         
        ReDim test(4)
        For i = 0 To 4
            test(i) = Cells(i + 1, 1).Value
        Next i
        
        Set my_range = ActiveSheet.Shapes.Range(test)
        my_range.Select
    It says "The specified parameter has an invalid value". Any idea how to solve this? I would expect it to be quite straightforward but it seems it isn't. Help will be much appreciated! Thanks.

Posting Permissions

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



Click Here to Expand Forum to Full Width