i am writing an application in excel 2003 using vba where i have created a user form that will display images on the form. i want to have the user select a folder from the open dialog box where the image files will be located. i am able to display the first image using the following code.
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = Application.DefaultFilePath & "\"
.Title = "Please choose the file for kappa study"
.Show
If .SelectedItems.Count = 0 Then
MsgBox "Cancelled"
Else
MsgBox .SelectedItems(1)
fileName = .SelectedItems(1) KappaForm.DefectImage.Picture = LoadPicture(fileName)
End If
End With
but i need to display the next image in the same folder when the user clicks the next button on the displayed form. my question is how do i display the next image in the same folder. the .selecteitems(1) selects only the first image and displays it. i have fileName declared as a public string variable.
all images i am displaying are in .jpg.
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = Application.DefaultFilePath & "\"
.Title = "Please choose the file for kappa study"
.Show
If .SelectedItems.Count = 0 Then
MsgBox "Cancelled"
Else
MsgBox .SelectedItems(1)
fileName = .SelectedItems(1) KappaForm.DefectImage.Picture = LoadPicture(fileName)
End If
End With
but i need to display the next image in the same folder when the user clicks the next button on the displayed form. my question is how do i display the next image in the same folder. the .selecteitems(1) selects only the first image and displays it. i have fileName declared as a public string variable.
all images i am displaying are in .jpg.