Can we scroll through images and change the aspect ratio in a UserForm?

USAMax

Well-known Member
Joined
May 31, 2006
Messages
843
Office Version
  1. 365
Platform
  1. Windows
I need to be able to select between windows used in home remolding. I have several GIF images that I would like to scroll through and I want to use their file names in the bill of material.

I also want to know if there is a way to change the aspect ratio based on the window's dimensions.


My thanks to my Mr Excel family.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Here is an example:

Code:
' user form module
Dim i%
Private Sub UserForm_Initialize()
i = 0
End Sub


Private Sub CommandButton1_Click()              ' click to change picture
Dim a, asp
a = Array("joke.gif", "charts.gif")
asp = Array(2, 3)                               ' aspect ratios
If i > UBound(a) Then i = 0
With Me.Image1
    .Picture = LoadPicture("c:\pub\" & a(i))    ' your directory here
    .Width = 50
    .Height = 50 * CDbl(asp(i))
    .PictureSizeMode = fmPictureSizeModeStretch
End With
Me.Repaint
Me.TextBox1 = "c:\pub\" & a(i)                  ' file name
i = i + 1
End Sub
 
Upvote 0
Worf, thank you so much for responding to my question and I am sorry have not seen it until now. It looks like it will work so I will test it out this weekend.

Thank you again!
 
Upvote 0

Forum statistics

Threads
1,215,537
Messages
6,125,394
Members
449,222
Latest member
taner zz

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