Open .dat files with a Hex Editor
-
25-12-2020 - |
Question
I'm trying to Open up a series of .dat files with a Hex Editor thru the vba in excel and then start a copy and paste process. Does anybody know how one can open up a file using a program other than excel inside the vba in Excel? Also I have a few errors in the code that I've written.
test = count
Do While (test >= 0)
Workbooks.Open Filename:=AllFiles(test) 'Open .dat file in order of Highest to Lowest count index. ERROR: SUBSCRIPT OUT OF RANGE. Need to open .dat files with Hex Edit HOW?
test = test - 1
Loop
'How do I manipulate the Hex Editor program: HxD with vba excel??
Solution
Opening a hex editor via vba to read a file then cut/paste the file's contents seems like overkill. If all you want is to read the file's data into a variable, then try the solutions posted here: http://www.excelforum.com/excel-programming/332741-getting-text-file-into-a-vba-string-variable.html which read a file directly into a variable, without having to resort to other apps and clipboard operations.
In essence, if you're trying to turn on a light, just flip the switch directly. Hiring/Firing someone to do it for you each time you enter/leave a room is highly inefficient.