VBA – Converting Between Decimal and Binary
4 stars based on
Expand your skills with this month's free Premium course. View April's Free Course. I need a solution. Any help would be appreciated. Sign up today x. Badotz Connect With a Mentor Commented: Take a look at this article, which comes with some working source code.
Thanks for your help so far. And here is a method to do just that it uses 'strHex' defined above: Hi, thanks for your posts. Okay, I'm almost there. I am using the following code: But it makes me feel secure: Vb will give an Error when it reaches above the Integer limit With that exponent. Everytime it makes it, it adds To the exponent, eventually making it to the max number of bits that can be in the number string. However, the code above gives the following output, which misses out the leading 0's of the binary as shown.
Ok, I see it now. I had left clipzeros set to true when converting the decimal to binary. Vbscript decimal to binary conversion, I set the MaxBit count at 8 instead of 20 which gave me the desired output of: Looking through the VB nightmare, this borked statement caught my eye: Not sure if this has any impact on your results, but you might want to go backwards from binary to ASCII to verfy they are the same?
Hi, Badotz, the line meant to read "Dim myHexidecimalArray 14 'Fixed size array as there is only 15 hex number max" and it was just vbscript decimal to binary conversion show that I would only be dealing with 15 hexidecimal values in my scenario and not refering to vbscript decimal to binary conversion actual number of hex characters available. Sorry, I should have made my commenting clearer: I have not done any of this before with asp so I need all the help I can get.
Add "4", "" values. Add "5", "" values. Add "6", "" values. Add "7", vbscript decimal to binary conversion values. Add "8", "" values. Add "9", "" values. Add "A", "" values. Add "B", "" values. Add "C", "" values. Add "D", "" values. Add "E", "" values. Here is a working HTML page: Hey Badotzthat conversion worksgreat! How do I pass ASP variables to and vbscript decimal to binary conversion it though? If I'm missing something, please clarify or show complete listings. The script is ran at a schedued time on the server with no user input.
It would be easier for me to rewrite the binary stuff in VB. If this sounds feasible, I can do vbscript decimal to binary conversion but n it won't be available 'til Monday mid-morning. If you email me your ASP page 8i70j3l02 sneakemail. Hi, I am still here! I may have found abetter way to do this job in vb using a 2 dimensional array instead of the multiple single arrays I have been using. I am going to try to get it working over the next hour or so and I'll let you know how I get on one way or the other.
Right, it seems to be working with the following: This is all needs to be decoded but kept together 'e. BTW, the txt file has the following format if you are interested: I still need to decode the binary further so it reads as plain english before writing it to the DB, but that's next week: Thanks for your help Badotz. Although Badotz didn't answer my question outright, he did help me along and gave me some good ideas.