+ Reply to Thread
Results 1 to 5 of 5

Imported Picture Pastes randomly.

  1. #1
    Registered User
    Join Date
    10-24-2006
    Posts
    5

    Imported Picture Pastes randomly.

    The code I'm currently working on imports a picture into Excel, resizes it, renames it, and attempts to place it in a designated range within the worksheet. No matter what I do to move the picture into the designated cell and then unselect the picture, the picture remains where it was originally pasted and stays selected. Any advice?

    Current Code:

    Sheets("SETUP").Select

    'tempx is a designated picture file

    ActiveSheet.Pictures.Insert(tempx).Select

    With Selection

    .Name = "Picture Logo"
    .ShapeRange.LockAspectRatio = msoFalse
    .ShapeRange.Height = 42.75
    .ShapeRange.Width = 43.5
    .Placement = xlMoveAndSize

    End With

    Selection.Cut

    'Logo is a designated range (cell address)

    Range("Logo").Select
    ActiveSheet.Paste

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    This code looks OK to me

  3. #3
    Registered User
    Join Date
    10-24-2006
    Posts
    5

    Unhappy still a problem

    I don't know why, but whichever cell I select before running the macros is the cell the picture gets pasted in. As well, if I try and unselect the picture after it pastes by selecting another cell as my last line of code, the picture remains selected when the macros has finished.

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Could the following help ...

    Please Login or Register  to view this content.
    HTH
    Carim

  5. #5
    Registered User
    Join Date
    10-24-2006
    Posts
    5

    Narrowing the problem

    I was able to fix the problem. I don't think I clearly defined the situation I was running into initially. The code was found on the SETUP worksheet and would run correctly until I got to the BLANK worksheet.

    'code for SETUP

    ActiveSheet.Pictures.Insert(tempx).Select

    Selection.Cut
    Range("Logo").Select
    ActiveSheet.Paste
    Range("LogoChoice").Select

    'code for BLANK

    Worksheets("BLANK").Select

    ActiveSheet.Pictures.Insert(tempx).Select

    Selection.Cut

    'this line fixed the random pasting of the image file

    Sheets("BLANK").Range("Logo2").Select
    ActiveSheet.Paste

    'this line successfully unselected the picture

    Sheets("BLANK").Range("Description").Select

    'THANKS EVERYONE THAT TRIED TO HELP
    Last edited by texx2000; 11-03-2006 at 11:27 AM.

+ 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