将字符串转换为ASCII数字

时间:2015-11-27 19:37:06

标签: excel vba excel-vba

我正在尝试使用Excel VBA编写一个函数来将字符串转换为其各自的ASCII编号。例如:

"ABCD" => "65666768"

我已编写此代码,但未能进行转换:

Public Function asciien(s As String) As String
' Returns the string to its respective ascii numbers
   Dim i As Integer

   For i = 1 To Len(s)
      asciien = asciien & CStr(Asc(Mid(s, x, 1)))
   Next i 

End Function

1 个答案:

答案 0 :(得分:2)

这一行

remove.setOnClickListener(new View.OnClickListener() {
         public void onClick(View v) {
             // Perform action on click
         }
     });

应该阅读

asciien = asciien & CStr(Asc(Mid(s, x, 1)))

“x”没有值