PP3321
Active Member
1. I have multiple photos in my folder on my pc(desktop)
2. I want to create slideshow for these photos on the userform.
3. I wrote below code, but it returns error.
It says file not found.
*I am basically trying to store all the photo names into array, and link the array to the image1 on the userform...
Could anyone please tell me what I am doing wrong here...?
2. I want to create slideshow for these photos on the userform.
3. I wrote below code, but it returns error.
It says file not found.
*I am basically trying to store all the photo names into array, and link the array to the image1 on the userform...
Could anyone please tell me what I am doing wrong here...?
Code:
Dim i As Long
Dim PhotoNames As String
Dim ArrayPhoto() As String
Private Sub UserForm_Initialize()
PhotoNames = Dir("C:\Users\Test\Desktop\FolderName\*.*")
ReDim ArrayPhoto(0)
Do While PhotoNames <> ""
i = UBound(ArrayPhoto) + 1
ReDim Preserve ArrayPhoto(i)
ArrayPhoto(i) = PhotoNames
Me.Image1.Picture = LoadPicture(ArrayPhoto(i))
PhotoNames = Dir()
Loop
End Sub