vba - Convert a hex string to base64 in an excel function -


I have a long string of hex values ​​that need to be changed to base 64.

I am looking for a simple format cell function such as = hex2b64 (hexstring) that will accept any length of hex characters. I have found pieces here and there but there is no simple code block.

I use this conversion manually to this point, the conversion works well and the data is derived from all relevant databases and appropriately parsed.

According to the data I have been receiving hex binary representation, which has been changed in many blocks and concatenated long hex is in the string in the project documentation that I am not able to implement

A typical input string will be:. Hex = 00014088F6650101393939393939392D30304646463238313030000343332353430342D35353FA10000002805900100002805

and corresponding output: B64 = AAFAiPZlAQE5OTk5OTk5LTAwRkZGMjgxMDAAA0MzI1NDA0LTU1P6EAAAAoBZABAAAoAF

  Function Hex2Base64 (ByVal strHex) Dim arrBytes then lane (strHex) Mod 2 & lt; & Gt; 0 then strakes = left (strakes, lane (strx) - 1) & amp; "0" & ​​amp; Wright (strHex, 1) Finish with CreateObject ("Microsoft.XMLDOM"). CreateElement ("objNode") .DataType = "bin.hex" .text = strHex arrBytes = .nodeTypedValue with CreateObject (ending with "Microsoft.XMLDOM") .createElement ("objNode") .DataType = "bin.base64" End.  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -