如:"123456678945678900"换成十六进制

解决方案 »

  1.   

    这是一个票据打印的例子,里面包含了将文字高低位拆解转换的方法过程
    Private Sub PrinterVal(strVal As String)Dim Devicer As New minipr
    Dim lngChar As Long
    Dim lngVal As Long
    Dim intLen As Integer    Devicer.SetPrinterType 0
        Devicer.InitComPort 2
        Devicer.Init
        For intLen = 1 To Len(strVal)
            lngVal = Asc(Mid(strVal, intLen, 1))
            If lngVal < 0 Then
               lngChar = 65536 + lngVal
               Devicer.printdata (lngChar - (lngChar Mod 256)) / 256
               Devicer.printdata lngChar Mod 256
            Else
               Devicer.printdata lngVal
            End If
        Next
        Devicer.printdata &HA
        Set devicectrl = NothingEnd Sub
      

  2.   


    private function Changeto(strIn as string)    dim i as integer
         for i=0 to len(strIn)
               debug.print hex(asc(mid(strIn,i,1)))
         next i
    end fuction