by Bharath (3 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 15th November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Build and HTML page with image preview of files in a folder.
Dim x As String
Private Sub Command1_Click()
'pass the path and pattern
Call convert("C:\justgreet", "*.jpg")
End Sub
Public Sub convert(path As String, pattern As String)
On Error GoTo z
'change the name of "C:\test.html" to the filename of your choice
Open "c:\test.html" For Output As 1
Print #1, "<HTML>"
Print #1, "<HEAD>"
Print #1, "<TITLE>" & path & "</TITLE>"
File1.path = path
File1.pattern = pattern
For i = 0 To File1.ListCount
If File1.List(i) = "" Then Exit Sub
s = File1.path + "\" + File1.List(i)
x = "<A href='" & s & "'" & "><IMG WIDTH=100 HEIGHT=100 SRC='" & s & "'></a>"
MsgBox x
Print #1, x
Next i
Exit Sub
z:
MsgBox Err.Description
End Sub