[COLOR=#000000][FONT=verdana]Function thumbCDR(file$) As StdPicture
Dim tmp$, hF&, s$, base&, wd As Byte, ht As Byte, bpp%, thLen&, ofs&, thumb As String * 30000, b4&, th1&
On Error Resume Next
hF = FreeFile()
Open file For Binary Access Read Shared As [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] : If Err.Number Then Exit Function
Get [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , , thumb
base = InStr(1, thumb, "DISP")
If base <= 0 Or base > 15000 Then Exit Function
Get [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , base + 16, wd
Get [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , base + 20, ht
Get [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , base + 26, bpp
Get [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , base + 32, thLen
Close
ofs = &H36 + Switch(bpp = 1, 2 * 4, bpp = 4, 16 * 4, True, 256 * 4)
th1=&H436 + CLng(ht) * CLng(wd):if th1>30000 then th1=30000
thLen = iif(thLen + ofs<th1,thLen + ofs, th1)
tmp = Environ("temp") + "thumb" + Hex$(Timer) + ".bmp"
Open tmp For Binary Access Write Lock Read Write As [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] : If Err.Number Then Exit Function
s = "BM": Put [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , , s ' 2 bytes
Put [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , , thLen ' 4 bytes
Put [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , , b4 ' 4 bytes zero
Put [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , , ofs ' 4 bytes
Put [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=hF]#hF[/URL] , , Mid$(thumb, base + 12, thLen - 14)
Close
Set thumbCDR = LoadPicture(tmp)
Kill tmp
End Function[/FONT][/COLOR]