如何把成批的数据转到excel里
有这样一组数据存在TEXT.txt里
04Dh,04Ch,04Bh,04Ah,049h,049h,048h,047h,045h,043h,042h,040h,03Eh,03Ch,03Ah,038h
038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h
038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h
038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h
038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h
038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h
039h,03Bh,03Dh,03Fh,041h,043h,045h,047h,047h,045h,043h,041h,03Fh,03Dh,03Bh,039h
038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h
039h,03Bh,03Dh,03Fh,041h,043h,045h,047h,047h,045h,043h,041h,03Fh,03Dh,03Bh,039h
038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h
如果要把它们依次放到EXCEL表的第一列该怎么做?能把他们转换为10进制数再存进去比如04DH,转换为77存到EXCEL表中。先谢谢了

解决方案 »

  1.   

    写个程序道如不就可以了吗?
    下面我是从数据库里到excel的你研究以下
    <%@ Language=VBScript %>
    <!--#INCLUDE FILE="check.asp"-->
    <%
    Response.Expires=0
    set dbbooks=server.CreateObject ("adodb.connection")
    dbpath=server.MapPath ("dbcqc.mdb")
    dbbooks.Open "DRIVER={Microsoft Access Driver (*.mdb)};dbq=" & dbpathSet xlApp = server.CreateObject("Excel.Application") strsource =Server.MapPath("upload\UploadFiles\rzqy.xls")
    Set MyFileObject=CreateObject("Scripting.FileSystemObject")
    if MyFileObject.FileExists(strsource) then
    'response.write strsource 
    'response.end
    Set xlbook = xlApp.Workbooks.Open(strsource) 
    Set xlsheet = xlbook.Worksheets(1) i=2 
    while xlsheet.cells(i,1)<>"" strsql="Insert Into stru (注册编号,专业项目,注册范围,企业名称,发证日期,有效日期,标准,类别) values ('"& xlsheet.Cells(i, 1) &"','"& xlsheet.Cells(i, 2) &"','"& xlsheet.Cells(i, 3) &"','"& xlsheet.Cells(i, 4) &"','"& xlsheet.Cells(i, 5) &"','"& xlsheet.Cells(i, 6) &"','"& xlsheet.Cells(i, 7) &"','"&xlsheet.Cells(i, 8)&"')"dbbooks.Execute strsqli=i+1 wend 
    set xlsheet=nothing 
    set dbbooks=nothing
    xlBook.Close (True)
    set xlbook=nothing 
    xlApp.quit 
    MyFileObject.deleteFile(strsource)
    set MyFileObject=nothing
    strJS="<SCRIPT language=javascript>" & vbcrlf
    strJS=strJS & "alert('文件导入成功!');" & vbcrlf
    strJS=strJS & "history.go(-1);" & vbcrlf  
    strJS=strJS & "</script>"
    response.write strJS
    else
    set MyFileObject=nothing
    strJS="<SCRIPT language=javascript>" & vbcrlf
    strJS=strJS & "alert('请先上传文件,然后在导入!');" & vbcrlf
    strJS=strJS & "history.go(-1);" & vbcrlf  
    strJS=strJS & "</script>"
    response.write strJS
    end if
    %>
      

  2.   

    数据库和文本不一样有没有文本导入EXCEL的例子?
      

  3.   

    用ado 现吧记录取出!
    然后
    Public Sub ToExcel(fn As String, rs As Recordset)
       Dim myExcel As New Excel.Application
       Dim myBook As New Excel.Workbook
       Dim mySheet As New Excel.Worksheet
       'Dim i As Integer   Set myBook = myExcel.Workbooks.Add '添加一个新的BOOK
       Set mySheet = myBook.Worksheets.Add '添加一个新的SHEET
       On Error GoTo IsNullErr
       If rs.RecordCount <= 0 Then
          MsgBox "无信息!", vbOKOnly + vbInformation, "导出"
        Exit Sub
       End If   myExcel.Visible = True
       mySheet.Cells.CopyFromRecordset rs'ado中的记录
       
      
       IsNullErr:
          MsgBox "无信息!", vbOKOnly + vbInformation, "导出"
          Exit Sub
        
       SaveErr:
          MsgBox Err.Description
      End Sub
      

  4.   

    Set appExcel = CreateObject("Excel.Application")
    appExcel.Visible = False
    appExcel.Workbooks.Open (App.Path & "\txt.xls")lIntRow = 1
    lIntCol = 4
    i = 0
    fileno1 = FreeFile()Open App.Path & "\test.txt" For Input As #fileno1Do While Not EOF(fileno1)
        MyChar = Input(1, #fileno1)
        If MyChar = "h" Then
            i = i + 1
            str(i) = Mid(Text1.Text, Len(Text1.Text) - 1, 2)
            Text2.Text = Text2.Text & Val("&H" & str(i)) & " " & " "
            appExcel.Cells(lIntRow, lIntCol) = Val("&H" & str(i))
            lIntRow = lIntRow + 1
        End If
       
        Text1.Text = Text1.Text + MyChar
        
    Loop
    Close #fileno1
    解决了,是这么弄的。