Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Hi,
    I have about 7 pictures that I've inserted into an Excel spreadsheet. When I recorded my macro to copy and paste one of these pictures it shows the following code:


    Sheets("logos").Select
    ActiveSheet.Shapes("Object 3").Select
    Selection.Copy
    Sheets("invoice template").Select
    ActiveSheet.Paste

    It calls it "Object 3"... when I copy and paste a different picture, the recorded macro doesn't show the following line:
    ActiveSheet.Shapes("Object 3").Select
    I think it's because when I look at it in Excel it says it's "Picture 1" instead of "Object 1".

    How do I turn the picture into an object so I can make my macros work. Or, why doesn't the recording capture the correct code and call it a picture???

    Thanks!
    Lana

  2. #2
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I finally got it to work... I renamed the picture to "object 6", then I had to change the code from:

    ActiveSheet.Shapes("Object 6").Select
    Selection.Copy


    to:

    ActiveSheet.Shapes("Object 6").Copy

    Then it worked.

    Thanks!
    Lana

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The name displayed in the Name box in Excel's formula bar is not necessarily the same as the name used by the Visual Basic Editor.

    If you explain what you want to accomplish, we may be able to come up with a suggestion.


Posting Permissions

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