我要選取圖片並讀取該圖片的像素, 下面的作法無法限定只抓.jpg檔會連同資料夾內所有檔案都會一一讀取, 該如何改成只抓.jpg檔?
[attach]33066[/attach]
Sub Pics()
Dim PicList As Variant, sFile As Variant
Dim oShell As Variant, oDir As Variant
Dim Dms(20) As String
SetCurrentDirectory ActiveWorkbook.Path
PicList = Application.GetOpenFilename(filefilter:="JPEG 檔案 (*.jpg),*.jpg", FilterIndex:=5, Title:="插入圖片", MultiSelect:=True)
Set oShell = CreateObject("Shell.Application")
Set oDir = oShell.Namespace(CurDir)
i = 1
For Each sFile In oDir.items
Dms(i) = sFile.extendedproperty("Dimensions")
MsgBox (Dms(i))
i = i + 1
Next