Friday, July 31, 2009

VB Macros : Code to convert String to Byte Array

Use StrConv function with "vbFromUniCode" to convert a VB String to a byte array of ANSI Charecters

Here is the Code

Dim srcString As String
Dim destArr() As Byte

secString = ActiveDesignFile.Name ' You can place any string here
destArr = StrConv(srcString, vbFormUniCode)

What this will do is that it will take your string, convert each charecter to ANSI, and store it in the designated array.

No comments:

Post a Comment