分享
分享赚钱 收藏 举报 版权申诉 / 3

类型VBA使用EXCEL读取身份证阅读器获得证件信息.doc

  • 上传人:精品资料
  • 文档编号:9531108
  • 上传时间:2019-08-13
  • 格式:DOC
  • 页数:3
  • 大小:12.62KB
  • 配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    VBA使用EXCEL读取身份证阅读器获得证件信息.doc
    资源描述:

    1、VBA 使用 EXCEL 读取身份证阅读器获得证件信息本代码实现了在 EXCEL 中调用精伦身份证阅读器控件(可在网上百度精伦二次开发包,里面有)读取身份证信息,可根据实际情况修改相关代码,源文件可在 EXCELhome 网站搜索下载。Private Declare Function InitComm Lib “Sdtapi.dll“ (ByVal iPort As Integer) As IntegerPrivate Declare Function CloseComm Lib “Sdtapi.dll“ () As IntegerPrivate Declare Function Authen

    2、ticate Lib “Sdtapi.dll“ () As IntegerPrivate Declare Function ReadBaseInfos Lib “Sdtapi.dll“ (ByVal iname As String, ByVal isex As String, ByVal folk As String, ByVal birthday As String, ByVal code As String, ByVal addr As String, ByVal agency As String, ByVal startdate As String, ByVal enddate As S

    3、tring) As IntegerSub 启动_Click()On Error Resume NextDim n, ret, nLenDim iname As String * 31Dim isex As String * 3Dim folk As String * 10Dim code As String * 19Dim addr As String * 71Dim birthday As String * 9Dim startdate As String * 9Dim enddate As String * 9Dim agency As String * 31Dim Msg As Stri

    4、ng * 300Dim Msg1 As String * 256Dim IINSNDN As String * 64Dim SAMID As String * 36Dim LenT As Integerret = InitComm(“1001“)If Err ThenErr.ClearMsgBox “端口错误“, vbOKOnly, “提示“Exit SubEnd Ifret = Authenticate()If (ret) Then MsgBox “找到卡,正在读卡.“ ret = MsgBox(“找到卡,正在读卡 .“, vbOKOnly + vbInformation, “提示“)ret

    5、 = ReadBaseInfos(iname, isex, folk, birthday, code, addr, agency, startdate, enddate)If (ret) Then MsgBox “读卡成功! “姓名Range(“a1“) = Trim(iname)性别Range(“a2“) = Trim(isex)民族Range(“a3“) = Trim(folk)出生年Range(“a4“) = Left(Trim(birthday), 4) + “年“ + Mid(Trim(birthday), 5, 2) + “月“ + Mid(Trim(birthday), 7, 2

    6、) + “日 “Range(“b4“) = Trim(birthday)住址Range(“a5“) = Trim(addr)公民身份号码Range(“a6“) = Trim(code)签发机关Range(“a7“) = Trim(agency)有效期限Range(“a8“) = Trim(enddate)If Trim(enddate) = “长期“ ThenRange(“b8“) = Left(Trim(startdate), 4) + “.“ + Mid(Trim(startdate), 5, 2) + “.“ + Mid(Trim(startdate), 7, 2) + “-长期“Els

    7、eRange(“b8“) = Left(Trim(startdate), 4) + “.“ + Mid(Trim(startdate), 5, 2) + “.“ + Mid(Trim(startdate), 7, 2) + “-“ + Left(Trim(enddate), 4) + “.“ + Mid(Trim(enddate), 5, 2) + “.“ + Mid(Trim(enddate), 7, 2)End If显示照片Pic.Picture = LoadPicture(App.Path + “photo.bmp“)ElseMsgBox “读卡不成功!请重新开始读卡。“End IfElseMsgBox “未找到卡!请将卡远离后再置于机具上。“End Ifret = CloseComm()End Sub

    展开阅读全文
    提示  道客多多所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:VBA使用EXCEL读取身份证阅读器获得证件信息.doc
    链接地址:https://www.docduoduo.com/p-9531108.html
    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    道客多多用户QQ群:832276834  微博官方号:道客多多官方   知乎号:道客多多

    Copyright© 2025 道客多多 docduoduo.com 网站版权所有世界地图

    经营许可证编号:粤ICP备2021046453号    营业执照商标

    1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10.png



    收起
    展开