HOW to create a Hexdecimal file using VBA

rickyfong

Registered User.
Local time
Yesterday, 16:13
Joined
Nov 25, 2010
Messages
199
I would like to read a TIFfle to ACCESS, and store its content as hexdecimal like below to further other process..., how can I achieve this change and storage?? Thanks a lot!!


0000: 49 49 2A 00 4E 00 00 00 80 3F E0 50 38 24 16 0D
0010: 07 84 42 61 50 B8 64 36 1D 0F 88 44 62 51 38 A4
0020: 56 2D 17 8C 46 63 51 B8 E4 76 3D 1F 90 48 64 52
0030: 39 24 96 4D 18 80 80 00 60 00 00 00 01 00 00 00
0040: 60 00 00 00 01 00 00 00 08 00 08 00 08 00 0F 00
0050: FE 00 04 00 01 00 00 00 00 00 00 00 00 01 03 00
0060: 01 00 00 00 11 00 00 00 01 01 03 00 01 00 00 00
0070: 0F 00 00 00 02 01 03 00 03 00 00 00 48 00 00 00
0080: 03 01 03 00 01 00 00 00 05 00 00 00 06 01 03 00

 
That kind of peaked my interest. Won't have a remote chance of testing this due to some big deadlines. But, it looks plausible.
This code was supposed to work on Excel 2003, but should work the same for Access 2003.
Bad news> Microsoft dropped this object from what they claim (in MSDN) was a licensing issue. Read several articles about how to download the 2003 object model and the VBA Help file. After reading this, I would not do this on my 2010 development workstation.


Required in Code Module Tools>References Menu 'Microsoft Office Document Imaging 11.0 Type Library'
Of course Microsoft in their wisdom didn't put this on Office 2010 (my version).
http://support.microsoft.com/kb/982760 Instruction on how to add.
Needless to say, on Office 2003, Microsoft forgot (or by design) to add the VBA help library. This is the site to download the VBA help file: http://office.microsoft.com/en-us/help/find-modi-vba-reference-on-msdn-HP001049034.aspx


Code:
Sub OCRReader()
Dim doc1 As MODI.Document 
Dim inputFile As String 
Dim strRecText As String 
Dim imageCounter As Integer
inputFile = Application.GetOpenFilename 
strRecText = ""
Set doc1 = New MODI.Document 
doc1.Create (inputFile) 
doc1.OCR 
For imageCounter = 0 To (doc1.Images.Count - 1) 
    strRecText = strRecText & doc1.Images(imageCounter).Layout.Text 
Next 
fnum = FreeFile() 
Open "C:\TEMP\testmodi.txt" For Output As fnum 
    Print #fnum, strRecText 
Close #fnum 
doc1.Close
End Sub

If it were me....
Microsoft dropped support and the blogs about this have 95% grief and complaints. So if it were me, I see that the marketplace has some supported solutions. This is in no way a recommendation - I found this site:
http://www.peernet.com/tiff-image-p...or-microsoft-office-document-imaging-printer/
They "claim" to have VBA, support, and more. Check it out for yourself.
If it prevented 100 hours of Microsoft induced headaches, my personal preference is to pay for software license, get a supported tool, and stay productive.
That is just me.

My conversion project will probably start once we convert to Office 2013 desktop. From the MSDN articles, Office 2013 has no support for that either.
 
Sorry! I have tried to understand the function coding, but at least I don't know where and how to put the TIF filename?? Thanks!!
 
Sinking!!?? :confused: I have tried to understand the function coding, but at least I don't know where and how to put the TIF filename?? Thanks!!:(
 
Files aren't stored in hexadecimal. Hexadecimal is a (more) human readable way to express binary, because the binary number 1111 is hexadecimal F, which is half a byte, which can store the number 11111111 (binary) or FF (hex), or 255 (decimal)
 

Users who are viewing this thread

Back
Top Bottom