Scroll through pictures in a folder

M

Mike

Hi i want to make a command button which scrolls through several pictures in
a folder. The Folder address will be made up of several fields in the form.
txtCoreAddress - will contain "C:\Documents\Pictures\"
txtSubFolder - will contain the next folder name "00001-00001"
The images within each folder are then number anything between 1 and 5,
making the address for one photo
C:\Documents\Pictures\00001-00001\3.JPG
I have no problem taking the above complete address and getting the image to
show, but have no idea how to make it scroll through only the pictures in
that folder.
Please advise
Mike
 
A

Arvin Meyer [MVP]

So store the path as 3 separate text fields then concatenate them as
necessary:

Drive:
C:\Documents\Pictures\

Path:
00001-00001\

FileName:
3.JPG

Then use:

Me.ImageCtl.Picture = txtDrive & txtPath & txtFileName
 
D

Douglas J. Steele

Dim strFolder As String
Dim strFile As String

strFolder = "C:\Documents\Pictures\00001-00001\"
strFile = Dir(strFolder & "*.jpg")
Do While Len(strFile) > 0
' at this point, strFolder & strFile should provide the complete
' path to a picture.
' Do whatever you want with it...

' This line will set strFile to point to another picture,
' or to a zero-length string if you've seen them all
strFile = Dir()
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top