Magnifyihg glass for userform

HYKE

Active Member
Joined
Jan 31, 2010
Messages
373
Hello there!

I have seen in this a cool magnifying glass by Jaafar and Ivan,but these magnifying glass operates only in excel sheet, do we have so far in this forum a magnifying glass meant for userform? The reason I am asking is because in my current project I have embedded images (jpeg files) in my userform with different images being loaded simultaneously. However, there are some infos I want to enlarged. I tried this magnifying glass by Jaafar and Ivan but I believe it is not meant for images in userforms...Can somebody help me find a magnifying glass for userform?

Thanks,

HYKE
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

HYKE

Active Member
Joined
Jan 31, 2010
Messages
373
Hi There,

I found this code in other excel site. This code is meant for zooming the image in the userform. I have incorporated the code in my userform and is so far just do what I want. My problem is once I clicked command button 3, the image stays zoomed every time I load a new image. Can somebody re-write the code that if I clicked backed on the list box that the image will go back to the same size as it was when it initially loaded. I have set the image picturesize mode to stretch.

Thanks for the help....
Code:
Option Explicit
Const MAX_ZOOM = 4    ' 400% original size
Const MIN_ZOOM = 0.2  ' 20%  original size
Private m_sngWidth As Single
Private m_sngHeight As Single
Private m_sngZoom As Single
Private Sub CommandButton1_Click()
 m_sngZoom = m_sngZoom + 0.1
    If m_sngZoom > MAX_ZOOM Then m_sngZoom = MAX_ZOOM
    CommandButton1.Enabled = m_sngZoom <> MAX_ZOOM
    CommandButton2.Enabled = m_sngZoom <> MIN_ZOOM
    SetZoom m_sngZoom
End Sub
Private Sub CommandButton2_Click()
    m_sngZoom = m_sngZoom - 0.1
    If m_sngZoom < MIN_ZOOM Then m_sngZoom = MIN_ZOOM
    CommandButton2.Enabled = m_sngZoom <> MIN_ZOOM
    CommandButton1.Enabled = m_sngZoom <> MAX_ZOOM
    SetZoom m_sngZoom
End Sub
Private Sub CommandButton3_Click()
With Image1
            .AutoSize = True
           ' .Picture = LoadPicture(Name)
            m_sngHeight = .Height
            m_sngWidth = .Width
            .AutoSize = False
            .PictureSizeMode = fmPictureSizeModeStretch
            m_sngZoom = 1
            .Left = 1
            .Top = 1
        End With
        SetZoom m_sngZoom
End Sub

Private Sub ListBox1_Click()
Dim ProdFound As Range
    With Sheet3.Range("C:C")
        Set ProdFound = .Find(ListBox1.Value)
        If ProdFound Is Nothing Then
            MsgBox ("ITEM NOT FOUND!")
            ListBox1.Value = ""
            Exit Sub
        Else
            With Range(ProdFound.Address)
            UserForm2.TextBox32.Value = .Offset(0, 1)
            UserForm2.TextBox33.Value = .Offset(0, 2)
            UserForm2.TextBox34.Value = .Offset(0, 3)
            UserForm2.TextBox35.Value = .Offset(0, 5)
            UserForm2.TextBox36.Value = .Offset(0, 7)
            UserForm2.TextBox37.Value = .Offset(0, 9)
            UserForm2.TextBox38.Value = .Offset(0, 10)
            UserForm2.TextBox39.Value = .Offset(0, 6)
            UserForm2.TextBox40.Value = .Offset(0, 8)
            UserForm2.Label45.Caption = .Offset(0, 0)
            UserForm2.Label46.Caption = .Offset(0, 1)
            'TextBox22.Value = .Offset(0, 19)
            'TextBox21.Value = .Offset(0, 0)
            'Label40.BackColor = RGB(255, 255, 0)
            
            On Error Resume Next
            Image1.Picture = LoadPicture _
            ("C:\Documents and Settings\" & Environ("username") & "\Desktop\MOBIL\" & UserForm2.Label45.Caption & ".jpg")
            On Error GoTo 0
            
            End With
        End If
    End With
End Sub
Sub SetZoom(Zoom As Single)
    With Image1
        .Width = m_sngWidth * Zoom
        .Height = m_sngHeight * Zoom
    End With
    Label48.Caption = "Zoom " & Format(Zoom, "0%")
    With Frame8
        .ScrollHeight = Image1.Height + 2
        .ScrollWidth = Image1.Width + 2
    End With
End Sub
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,108
Messages
5,857,435
Members
431,879
Latest member
KiwDaWabbit

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
Top