VBA中怎么判断一个字符是否是大写A到Z的字母,这个字符可能是符号,数字,小写字母,怎么判断它是否是大写的A到Z的字母,除了可以些个函数实现之外,VBA中有没有方法直接可以实现?多谢各位大侠!

解决方案 »

  1.   

    找asc码吧,A到Z有相应的asc码
      

  2.   

    65 = A,66 = B,67 = C,68 = D,69 = E,70 = F,71 = G,72 = H,73 = I,74 = J,75 = K,76 = L,77 = M,78 = N,79 = O,80 = P,81 = Q,82 = R,83 = S,84 = T,85 = U,86 = V,87 = W,88 = X,89 = Y,90 = Z
    用ASC(Char)判断一下Private Function bIsCap(byval sChar as String)as boolean
      bIsCap=(ASC(sChar)>64 and ASC(sChar)<91)
    End Function
      

  3.   

    if asc(char)>64 and asc(char)<91 then
        messagebox "is letter"
    end if
      

  4.   

    If AChar >= "A" And AChar <= "Z" Then
        ......
    End If
      

  5.   


    If asc(AChar) >= asc("A") And asc(AChar) <= asc("Z") Then
        debug.print "yes"
    End If
      

  6.   

    function checkchar(char as string) as boolen
    dim s as string,s1 as string
    s="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    s1=left$(char,1)
    if instr(1,s,s1)>0 then checkchar=true
    end function
      

  7.   

    iif(cchar>="A" and cchar<="Z",true,false)