Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel height and width of a pictures

Hi!

Prompt how to receive parametres of a picture by means of VBA for Excel, namely height and width in pixels.

Which I apply an example more low, does not work properly.

Private Type ThePicInfo

Type As String

Width As Long

Height As Long

End Type

Private Function CheckPicSpecs (TheFile) As ThePicInfo

Dim TheContent, TheImageInfo As ThePicInfo, TheVar, TheFreeFile

TheFreeFile = FreeFile

Open TheFile For Binary As TheFreeFile

TheContent = Input (10, TheFreeFile)

Close TheFreeFile

If Mid (TheContent, 7, 4) = "JFIF" Then

TheImageInfo. Type = "JPG"

Open TheFile For Binary As TheFreeFile

TheContent = Input (167, TheFreeFile)

Close TheFreeFile

TheImageInfo. Height = Asc (Mid (TheContent, 165, 1)) + 256 *

Asc (Mid (TheContent, 164, 1))

TheImageInfo. Width = Asc (Mid (TheContent, 167, 1)) + 256 *

Asc (Mid (TheContent, 166, 1))

End If

If Mid (TheContent, 1, 3) = "GIF" Then

TheImageInfo. Type = "GIF"

TheImageInfo. Width = Asc (Mid (TheContent, 7, 1)) + 256 * Asc (Mid (TheContent,

8, 1))

TheImageInfo. Height = Asc (Mid (TheContent, 9, 1)) + 256 * Asc (Mid (TheContent,

10, 1))

End If

CheckPicSpecs = TheImageInfo

End Function

Private Sub Command1_Click ()

Dim an As ThePicInfo

' as parametre of function CheckPicSpecs instal path to your picture

a = CheckPicSpecs ("D:\garbage\way2house.gif")

MsgBox a. Type

MsgBox a. Width

MsgBox a. Height

End Sub





Thankful in advance


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 beta 2 - Row Height/Column Width suggestions Julian Excel Discussion (Misc queries) 0 September 30th 06 11:24 AM
Name Box Width and Height Werner Rohrmoser Excel Programming 2 June 28th 06 01:16 PM
How do i change the height and width of a single cell in Excel? lotus1107 Charts and Charting in Excel 1 August 8th 05 02:36 AM
Can I make column width and row height equal (a grid) in Excel? Buzzcut Excel Discussion (Misc queries) 1 May 3rd 05 05:24 PM
Excel 2002: Format Cell Height/Width buddyfl Excel Discussion (Misc queries) 1 January 31st 05 06:01 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ╘2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"