Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32

Thread: Zoom in on an image (picture) displayed in workbook
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Aug 2009
    Location
    Allen, TX
    Posts
    96
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Zoom in on an image (picture) displayed in workbook

    I'm using the following code to display an image in a workbook.
    Code:
    Sub Image21()
        On Error GoTo ProcExit21
        Dim objPicture As Picture
        With Sheets("Working").Cells(1, 1) ' Picture displays in cell from row, column
            Set objPicture = .Parent.Pictures.Insert(Sheets("Working").Cells(2, gvarImgColumn + 20).Value) ' Picture path row, column
            objPicture.Width = Sheets("Parameters").Cells(83, 2).Value
            'objPicture.Height = Sheets("Parameters").Cells(84, 2).Value
            objPicture.Top = Sheets("Parameters").Cells(85, 2).Value
            objPicture.Left = Sheets("Parameters").Cells(86, 2).Value
            objPicture.Border.Color = RGB(69, 107, 43)
            objPicture.Border.Weight = xlThick
            objPicture.Border.LineStyle = xlContinuous
        End With
    ProcExit21:
    End Sub
    I would like to be able to zoom in on the image. I am not looking to simply make the image bigger; that I can do. I can control contrast and brightness for all images displayed, rotate a single image, and more, but I am not seeing how I can zoom in on a single image.

    Is there a way?

    Thanks in advance,
    Andrew
    Last edited by SerenityNetworks; Sep 27th, 2019 at 06:45 PM.

  2. #2
    Board Regular
    Join Date
    Aug 2009
    Location
    Allen, TX
    Posts
    96
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    I realize I should probably add some detail on the project use. Here is an example:
    • I load four local images into the worksheet using the above code.
    • The user types information regarding the images into cells (not a user form).
    • The user clicks a button. The four images are removed and four new images load.
    • The process repeats.
    • Ideally, I would like for the user to be able to click and drag over an area on one of the images and have that section either appear as a new image on the worksheet or replace the original image.


    I've been wondering if I could use the click and drag to define a crop area. Effectively, the cropped image would be a zoom of the original once the crop was set to the same dimensions as the original. I'm not trying to save the new image. I just want to view an area of the original more closely.

    I've seen where there are some solid image controls when the image is displayed in a userform, but I'd rather stay away from this method if possible. (Although, if there is no alternative then I'm open to loading the image into a userform, so the zoom is possible.)

    Thanks,
    Andrew

    PS. I can understand and muddle my way around VBA when provided an example, but I'm not a developer by trade. There's not much code that I can write by scratch.
    Last edited by SerenityNetworks; Sep 27th, 2019 at 07:44 PM. Reason: Provide more detail regarding the objective.

  3. #3
    Board Regular
    Join Date
    Mar 2015
    Posts
    4,055
    Post Thanks / Like
    Mentioned
    73 Post(s)
    Tagged
    8 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    Are the 4 images always placed in the same cells as the previous 4 images ?
    Are there any other images on this worksheet ?
    Last edited by Yongle; Sep 27th, 2019 at 07:52 PM.

  4. #4
    Board Regular
    Join Date
    Aug 2009
    Location
    Allen, TX
    Posts
    96
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    The images (pictures) are inserted/displayed in the worksheet. They are not placed in cells. The macro provides the coordinates for where they are displayed.

    Thanks.

  5. #5
    Board Regular
    Join Date
    Mar 2015
    Posts
    4,055
    Post Thanks / Like
    Mentioned
    73 Post(s)
    Tagged
    8 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    Are there any other images in the worksheet ?

  6. #6
    Board Regular
    Join Date
    Aug 2009
    Location
    Allen, TX
    Posts
    96
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    Yes. The four displayed by the macro. (See above.) There are no others.
    Last edited by SerenityNetworks; Sep 27th, 2019 at 08:10 PM.

  7. #7
    Board Regular
    Join Date
    Mar 2015
    Posts
    4,055
    Post Thanks / Like
    Mentioned
    73 Post(s)
    Tagged
    8 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    The question you asked refers to 4 images - are there any other images in the sheet ?

  8. #8
    Board Regular
    Join Date
    Aug 2009
    Location
    Allen, TX
    Posts
    96
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    Sorry. No. There are no other images.

  9. #9
    Board Regular
    Join Date
    Mar 2015
    Posts
    4,055
    Post Thanks / Like
    Mentioned
    73 Post(s)
    Tagged
    8 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    I will post some code tomorrow. (Gone midnight here)

    But here is a suggested approach

    Add 4 transparent active-X labels
    They are placed above the images
    Active-X objects have a MouseMove event which can be the required trigger
    Zoom is a temporary resizing with mouseover

    Are any macros attached to the images ? (Does clicking on an images run a Macro ?)

  10. #10
    Board Regular
    Join Date
    Aug 2009
    Location
    Allen, TX
    Posts
    96
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Zoom in on an image (picture) displayed in workbook

    Yes. Clicking an image expands it and brings it to the front. This used to be adequate for the user to see the detail needed. But now the pictures have changed and often the detail the user needs to see is too small. Hence the need for the zoom. It would be very good if the zoom could persist while the user types the information into cells, but it's not an absolute requirement.

    Thanks!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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