Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • Last Modified:

Binary text file, macro to convert to ASCII ?

Hi,

HAs anyone come across a macro to convert files in binry format to ASCII ?

Thanks
Kieran
0
kieranjcollins
Asked:
kieranjcollins
  • 2
  • 2
1 Solution
 
borgunitCommented:
Here is a web pages version of Binary to ASCII source
//Ascii -- Binary Code
if (let ==  "A") {letbin = letbin + sep + '01000001'}
if (let ==  "B") {letbin = letbin + sep + '01000010'}
if (let ==  "C") {letbin = letbin + sep + '01000011'}
if (let ==  "D") {letbin = letbin + sep + '01000100'}
if (let ==  "E") {letbin = letbin + sep + '01000101'}
if (let ==  "F") {letbin = letbin + sep + '01000110'}
if (let ==  "G") {letbin = letbin + sep + '01000111'}
if (let ==  "H") {letbin = letbin + sep + '01001000'}
if (let ==  "I") {letbin = letbin + sep + '01001001'}
if (let ==  "J") {letbin = letbin + sep + '01001010'}
if (let ==  "K") {letbin = letbin + sep + '01001011'}
if (let ==  "L") {letbin = letbin + sep + '01001100'}
if (let ==  "M") {letbin = letbin + sep + '01001101'}
if (let ==  "N") {letbin = letbin + sep + '01001110'}
if (let ==  "O") {letbin = letbin + sep + '01001111'}
if (let ==  "P") {letbin = letbin + sep + '01010000'}
if (let ==  "Q") {letbin = letbin + sep + '01010001'}
if (let ==  "R") {letbin = letbin + sep + '01010010'}
if (let ==  "S") {letbin = letbin + sep + '01010011'}
if (let ==  "T") {letbin = letbin + sep + '01010100'}
if (let ==  "U") {letbin = letbin + sep + '01010101'}
if (let ==  "V") {letbin = letbin + sep + '01010110'}
if (let ==  "W") {letbin = letbin + sep + '01010111'}
if (let ==  "X") {letbin = letbin + sep + '01011000'}
if (let ==  "Y") {letbin = letbin + sep + '01011001'}
if (let ==  "Z") {letbin = letbin + sep + '01011010'}
if (let ==  "a") {letbin = letbin + sep + '01100001'}
if (let ==  "b") {letbin = letbin + sep + '01100010'}
if (let ==  "c") {letbin = letbin + sep + '01100011'}
if (let ==  "d") {letbin = letbin + sep + '01100100'}
if (let ==  "e") {letbin = letbin + sep + '01100101'}
if (let ==  "f") {letbin = letbin + sep + '01100110'}
if (let ==  "g") {letbin = letbin + sep + '01100111'}
if (let ==  "h") {letbin = letbin + sep + '01101000'}
if (let ==  "i") {letbin = letbin + sep + '01101001'}
if (let ==  "j") {letbin = letbin + sep + '01101010'}
if (let ==  "k") {letbin = letbin + sep + '01101011'}
if (let ==  "l") {letbin = letbin + sep + '01101100'}
if (let ==  "m") {letbin = letbin + sep + '01101101'}
if (let ==  "n") {letbin = letbin + sep + '01101110'}
if (let ==  "o") {letbin = letbin + sep + '01101111'}
if (let ==  "p") {letbin = letbin + sep + '01110000'}
if (let ==  "q") {letbin = letbin + sep + '01110001'}
if (let ==  "r") {letbin = letbin + sep + '01110010'}
if (let ==  "s") {letbin = letbin + sep + '01110011'}
if (let ==  "t") {letbin = letbin + sep + '01110100'}
if (let ==  "u") {letbin = letbin + sep + '01110101'}
if (let ==  "v") {letbin = letbin + sep + '01110110'}
if (let ==  "w") {letbin = letbin + sep + '01110111'}
if (let ==  "x") {letbin = letbin + sep + '01111000'}
if (let ==  "y") {letbin = letbin + sep + '01111001'}
if (let ==  "z") {letbin = letbin + sep + '01111010'}
if (let ==  " ") {letbin = letbin + sep + '00100000'} 

//Numbers:
if (let ==  "0") {letbin = letbin + sep + '00110000'}
if (let ==  "1") {letbin = letbin + sep + '00110001'}
if (let ==  "2") {letbin = letbin + sep + '00110010'}
if (let ==  "3") {letbin = letbin + sep + '00110011'}
if (let ==  "4") {letbin = letbin + sep + '00110100'}
if (let ==  "5") {letbin = letbin + sep + '00110101'}
if (let ==  "6") {letbin = letbin + sep + '00110110'}
if (let ==  "7") {letbin = letbin + sep + '00110111'}
if (let ==  "8") {letbin = letbin + sep + '00111000'}
if (let ==  "9") {letbin = letbin + sep + '00111001'}

//Special Characters:
if (let ==  "!") {letbin = letbin + sep + '00100001'}
if (let ==  "\"") {letbin = letbin + sep + '00100010'}
if (let ==  "#") {letbin = letbin + sep + '00100011'}
if (let ==  "$") {letbin = letbin + sep + '00100100'}
if (let ==  "%") {letbin = letbin + sep + '00100101'}
if (let ==  "&") {letbin = letbin + sep + '00100110'}
if (let ==  "'") {letbin = letbin + sep + '00100111'}
if (let ==  "(") {letbin = letbin + sep + '00101000'}
if (let ==  ")") {letbin = letbin + sep + '00101001'}
if (let ==  "*") {letbin = letbin + sep + '00101010'}
if (let ==  "+") {letbin = letbin + sep + '00101011'}
if (let ==  ",") {letbin = letbin + sep + '00101100'}
if (let ==  "-") {letbin = letbin + sep + '00101101'}
if (let ==  ".") {letbin = letbin + sep + '00101110'}
if (let ==  "/") {letbin = letbin + sep + '00101111'}
if (let ==  ":") {letbin = letbin + sep + '00111010'}
if (let ==  ";") {letbin = letbin + sep + '00111011'}
if (let ==  "<") {letbin = letbin + sep + '00111100'}
if (let ==  "=") {letbin = letbin + sep + '00111101'}
if (let ==  ">") {letbin = letbin + sep + '00111110'}
if (let ==  "?") {letbin = letbin + sep + '00111111'}
if (let ==  "@") {letbin = letbin + sep + '01000000'}
if (let ==  "[") {letbin = letbin + sep + '01011011'}
if (let ==  "\\") {letbin = letbin + sep + '01011100'}
if (let ==  "]") {letbin = letbin + sep + '01011101'}
if (let ==  "^") {letbin = letbin + sep + '01011110'}
if (let ==  "_") {letbin = letbin + sep + '01011111'}
if (let ==  "`") {letbin = letbin + sep + '01100000'}
if (let ==  "{") {letbin = letbin + sep + '01111011'}
if (let ==  "|") {letbin = letbin + sep + '01111100'}
if (let ==  "}") {letbin = letbin + sep + '01111101'}
if (let ==  "~") {letbin = letbin + sep + '01111110'}
if (let ==  "¬") {letbin = letbin + sep + '10000000'}
if (let ==  "¡") {letbin = letbin + sep + '10100001'}
if (let ==  "¢") {letbin = letbin + sep + '10100010'}
if (let ==  "£") {letbin = letbin + sep + '10100011'}
if (let ==  "¤") {letbin = letbin + sep + '10100100'}
if (let ==  "¥") {letbin = letbin + sep + '10100101'}
if (let ==  "¦") {letbin = letbin + sep + '10100110'}
if (let ==  "§") {letbin = letbin + sep + '10100111'}
if (let ==  "¨") {letbin = letbin + sep + '10100111'}
if (let ==  "©") {letbin = letbin + sep + '10101001'}
if (let ==  "ª") {letbin = letbin + sep + '10101010'}
if (let ==  "«") {letbin = letbin + sep + '10101011'}
if (let ==  "¬") {letbin = letbin + sep + '10101100'}
if (let ==  "­") {letbin = letbin + sep + '10101101'}
if (let ==  "®") {letbin = letbin + sep + '10101110'}
if (let ==  "¯") {letbin = letbin + sep + '10101111'}
if (let ==  "°") {letbin = letbin + sep + '10110000'}
if (let ==  "±") {letbin = letbin + sep + '10110001'}
if (let ==  "²") {letbin = letbin + sep + '10110010'}
if (let ==  "³") {letbin = letbin + sep + '10110011'}
if (let ==  "´") {letbin = letbin + sep + '10110100'}
if (let ==  "µ") {letbin = letbin + sep + '10110101'}
if (let ==  "¶") {letbin = letbin + sep + '10110110'}
if (let ==  "·") {letbin = letbin + sep + '10110111'}
if (let ==  "¸") {letbin = letbin + sep + '10111000'}
if (let ==  "¹") {letbin = letbin + sep + '10111001'}
if (let ==  "º") {letbin = letbin + sep + '10111010'}
if (let ==  "»") {letbin = letbin + sep + '10111011'}
if (let ==  "¼") {letbin = letbin + sep + '10111100'}
if (let ==  "½") {letbin = letbin + sep + '10111101'}
if (let ==  "¾") {letbin = letbin + sep + '10111110'}
if (let ==  "¿") {letbin = letbin + sep + '10111111'}
if (let ==  "À") {letbin = letbin + sep + '11000000'}
if (let ==  "Á") {letbin = letbin + sep + '11000001'}
if (let ==  "Â") {letbin = letbin + sep + '11000010'}
if (let ==  "Ã") {letbin = letbin + sep + '11000011'}
if (let ==  "Ä") {letbin = letbin + sep + '11000100'}
if (let ==  "Å") {letbin = letbin + sep + '11000101'}
if (let ==  "Æ") {letbin = letbin + sep + '11000110'}
if (let ==  "Ç") {letbin = letbin + sep + '11000111'}
if (let ==  "È") {letbin = letbin + sep + '11001000'}
if (let ==  "É") {letbin = letbin + sep + '11001001'}
if (let ==  "Ê") {letbin = letbin + sep + '11001010'}
if (let ==  "Ë") {letbin = letbin + sep + '11001011'}
if (let ==  "Ì") {letbin = letbin + sep + '11001100'}
if (let ==  "Í") {letbin = letbin + sep + '11001101'}
if (let ==  "Î") {letbin = letbin + sep + '11001110'}
if (let ==  "Ï") {letbin = letbin + sep + '11001111'}
if (let ==  "Ð") {letbin = letbin + sep + '11010000'}
if (let ==  "Ñ") {letbin = letbin + sep + '11010001'}
if (let ==  "Ò") {letbin = letbin + sep + '11010010'}
if (let ==  "Ó") {letbin = letbin + sep + '11010011'}
if (let ==  "Ô") {letbin = letbin + sep + '11010100'}
if (let ==  "Õ") {letbin = letbin + sep + '11010101'}
if (let ==  "Ö") {letbin = letbin + sep + '11010110'}
if (let ==  "×") {letbin = letbin + sep + '11010111'}
if (let ==  "Ø") {letbin = letbin + sep + '11011000'}
if (let ==  "Ù") {letbin = letbin + sep + '11011001'}
if (let ==  "Ú") {letbin = letbin + sep + '11011010'}
if (let ==  "Û") {letbin = letbin + sep + '11011011'}
if (let ==  "Ü") {letbin = letbin + sep + '11011100'}
if (let ==  "Ý") {letbin = letbin + sep + '11011101'}
if (let ==  "Þ") {letbin = letbin + sep + '11011110'}
if (let ==  "ß") {letbin = letbin + sep + '11011111'}
if (let ==  "à") {letbin = letbin + sep + '11100000'}
if (let ==  "á") {letbin = letbin + sep + '11100001'}
if (let ==  "â") {letbin = letbin + sep + '11100010'}
if (let ==  "ã") {letbin = letbin + sep + '11100011'}
if (let ==  "ä") {letbin = letbin + sep + '11100100'}
if (let ==  "å") {letbin = letbin + sep + '11100101'}
if (let ==  "æ") {letbin = letbin + sep + '11100110'}
if (let ==  "ç") {letbin = letbin + sep + '11100111'}
if (let ==  "è") {letbin = letbin + sep + '11101000'}
if (let ==  "é") {letbin = letbin + sep + '11101001'}
if (let ==  "ê") {letbin = letbin + sep + '11101010'}
if (let ==  "ë") {letbin = letbin + sep + '11101011'}
if (let ==  "ì") {letbin = letbin + sep + '11101100'}
if (let ==  "í") {letbin = letbin + sep + '11101101'}
if (let ==  "î") {letbin = letbin + sep + '11101110'}
if (let ==  "ï") {letbin = letbin + sep + '11101111'}
if (let ==  "ð") {letbin = letbin + sep + '11110000'}
if (let ==  "ñ") {letbin = letbin + sep + '11110001'}
if (let ==  "ò") {letbin = letbin + sep + '11110010'}
if (let ==  "ó") {letbin = letbin + sep + '11110011'}
if (let ==  "ô") {letbin = letbin + sep + '11110100'}
if (let ==  "õ") {letbin = letbin + sep + '11110101'}
if (let ==  "ö") {letbin = letbin + sep + '11110110'}
if (let ==  "÷") {letbin = letbin + sep + '11110111'}
if (let ==  "ø") {letbin = letbin + sep + '11111000'}
if (let ==  "ù") {letbin = letbin + sep + '11111001'}
if (let ==  "ú") {letbin = letbin + sep + '11111010'}
if (let ==  "û") {letbin = letbin + sep + '11111011'}
if (let ==  "û") {letbin = letbin + sep + '11111100'}
if (let ==  "ý") {letbin = letbin + sep + '11111101'}
if (let ==  "þ") {letbin = letbin + sep + '11111110'}
if (let ==  "ÿ") {letbin = letbin + sep + '11111111'}

}

Open in new window

0
 
jasfoutCommented:
Im not sure how your binary data is stored, but this function will convert an 8 bit cell to ascii.  If cells are more than 8 bits, it should be fairly easy modify to fit your needs.

Public Function BinaryToAscii(binaryin)
    Dim ilen As Integer
    Dim idec As Integer
    ilen = Len(binaryin)
    For i = 1 To ilen
        idec = idec + Mid(binaryin, i, 1) * 2 ^ (ilen - i)
    Next
    BinaryToAscii = Chr(idec)
End Function

Open in new window

0
 
jasfoutCommented:
If I was off-base with you request, perhaps this freeware tool will do the trick:
http://www.gdargaud.net/Hack/BinToAscii.html
0
 
kieranjcollinsAuthor Commented:

Aftersome googling, found the solution:
http://www.ultraedit.com 
0
 
kieranjcollinsAuthor Commented:
Gave good direction with what I wanted to do

Although went with Ultra Edit
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now