Quantcast
Channel: OKWAVE 最新質問(Visual Basic/257)【本日】
Viewing all articles
Browse latest Browse all 7264

フォルダーに入った画像名の取得したい

$
0
0
VB初心者です。色々調べて、セルに「画像名と画像サイズ一覧」を 書き出すことができました。 しかし、書き出せたのはjpgだけで、gifやpngをフォルダー内に入れると エラーが・・・・ どうしたらgifやpngも書き出せるコードになるか教えてください。 よろしくお願いします。 書いたコードは下記です。 Sub GetImageSize(ByVal f, ByRef x, ByRef y) Dim p Set p = LoadPicture(f) x = CLng(CDbl(p.Width) * 24 / 635) y = CLng(CDbl(p.Height) * 24 / 635) Set p = Nothing End Sub Sub main() Dim FSO As New FileSystemObject Dim FLD As Folder Dim FLE As File Dim FF As File Dim x As Long Dim y As Long Set FLD = FSO.GetFolder("C:\画像の入ったフォルダー名") For Each FF In FLD.Files Call GetImageSize(FF, x, y) Name = FF.Name Name_x = x Name_y = y myCnt = myCnt + 1 Cells(myCnt, "A").Value = FF.Name Cells(myCnt, "B").Value = x Cells(myCnt, "C").Value = y Next FF End Sub

Viewing all articles
Browse latest Browse all 7264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>