View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika Dick Kusleika is offline
external usenet poster
 
Posts: 179
Default EXCEL USERFORM

Gary

Here's a sub in the Initialize event that will find all the jpg's in a
folder and list them on your userform.

Private Sub UserForm_Initialize()

Dim Fldr As String
Dim FName As String
Dim i As Long
Dim cnt As Control

Fldr = "C:\My Documents\My Pictures\"

FName = Dir(Fldr & "*.jpg")
i = 10

Do While Len(FName) 0
Set cnt = Me.Controls.Add("forms.checkbox.1", , True)
cnt.Top = i
cnt.Left = 10

Set cnt = Me.Controls.Add("forms.label.1", , True)
cnt.Top = i
cnt.Left = 30
cnt.Caption = FName

i = i + 30
FName = Dir
Loop

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Gary Burke" wrote in message
...
Hi there,

Have a desire/need to populate a userform (continuous form ??) with a
list of files from a folder (of a selected type only - pictures), and
provide the facility to search other folders, so am guessing that i
would list the selected files(of a given type) and folders. I know I
could use the interface to windows, to activate the windows "Open File"
dialogue box, but dont to do that.

I would also like to have on the form, a check box, against each file
listed, so the user may "select" the file they wish to use. Propose
adding an "execute" button, to do something with the file once selected.
This will be to insert the picture into a designated area on the excel
worksheet, and to resize it.




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!