Zoom in on an image (picture) displayed in workbook

SerenityNetworks

Board Regular
Joined
Aug 13, 2009
Messages
131
Office Version
  1. 365
Platform
  1. Windows
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:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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:
Upvote 0
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:
Upvote 0
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.
 
Upvote 0
Are there any other images in the worksheet ?
 
Upvote 0
Yes. The four displayed by the macro. (See above.) There are no others.
 
Last edited:
Upvote 0
The question you asked refers to 4 images - are there any other images in the sheet ?
 
Upvote 0
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 ?)
 
Upvote 0
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!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,331
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top