«

»

Apr 20

Print this Post

File Icon Selector Function (pickIcon)

Selects an icon for displaying a file link based on the file extension.

The icons used are contained in the following zip file.

Icons
Icons
icons.zip
15.0 KiB
27 Downloads
Details
function pickIcon(strFile)
	arrFileName = split(strFile,".")
	strExt = lcase(arrFileName(ubound(arrFileName)))
	select case strExt
		case "ppt","pptx"
			pickIcon = "<img src='icons/PowerPointIcon.gif' border='0' width='36' height='36'>"
		case "ptm"
			pickIcon = "<img src='icons/MapPoint.gif' border='0' width='36' height='36'>"
		case "doc","docx"
			pickIcon = "<img src='icons/WordIcon.gif' border='0' width='36' height='36'>"
		case "xls","xlsx"
			pickIcon = "<img src='icons/ExcelIcon.gif' border='0' width='36' height='36'>"
		case "pdf"
			pickIcon = "<img src='icons/AcrobatIcon.gif' border='0' width='36' height='36'>"
		case "zip"
			pickIcon = "<img src='icons/WinZipIcon.gif' border='0' width='36' height='36'>"
		case "txt","text"
			pickIcon = "<img src='icons/TextIcon.gif' border='0' width='36' height='36'>"
		case "swf"
			pickIcon = "<img src='icons/Flash.gif' border='0' width='36' height='36'>"
		case "exe","com","bat"
			pickIcon = "<img src='icons/cmd.gif' border='0' width='36' height='36'>"
		case "htm","html"
			pickIcon = "<img src='icons/HTML.gif' border='0' width='36' height='36'>"
		case "asp"
			pickIcon = "<img src='icons/asp.gif' border='0' width='36' height='36'>"
		case "avi","mpg","mpeg"
			pickIcon = "<img src='icons/Video.gif' border='0' width='36' height='36'>"
		case "jpg","gif","png","jpeg","bmp","tif","tiff"
			pickIcon = "<img src='" & strFile & "' border='0' width='36' height='36'>"
		case else
			pickIcon = "<img src='icons/UnknownIcon.gif' border='0' width='36' height='36'>"
	end select
end function

Permanent link to this article: https://www1.wperry.net/code/pickicon/

Leave a Reply

Your email address will not be published. Required fields are marked *