Zoom in on an image (picture) displayed in workbook

SerenityNetworks

Board Regular
Joined
Aug 13, 2009
Messages
96
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:

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

SerenityNetworks

Board Regular
Joined
Aug 13, 2009
Messages
96
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:

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
5,259
Office Version
365
Platform
Windows
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:

SerenityNetworks

Board Regular
Joined
Aug 13, 2009
Messages
96
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.
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
5,259
Office Version
365
Platform
Windows
Are there any other images in the worksheet ?
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
5,259
Office Version
365
Platform
Windows
The question you asked refers to 4 images - are there any other images in the sheet ?
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
5,259
Office Version
365
Platform
Windows
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 ?)
 

SerenityNetworks

Board Regular
Joined
Aug 13, 2009
Messages
96
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!
 

Forum statistics

Threads
1,089,491
Messages
5,408,583
Members
403,216
Latest member
Boba Fetts

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top