Private Type BodyData
    xuhao As Integer
    nl As Integer
End TypePrivate Sub Command1_Click()
Dim jj As BodyData
Dim filenum  As Integerfilenum = 1
Open "C:\user\abcd.txt" For Random As #filenum Len = Len(jj)jj.xuhao = 1
jj.nl = 1If Dir("C:\user", vbDirectory) = "" Then MkDir "C:\user"Put #filenum, , jj
Close #filenum
End Sub

解决方案 »

  1.   

    Private Type BookInfo
        Title As String
        ISBN As String
        URL As String
    End Type
    Private MaxBook As Integer
    Private BookInfos() As BookInfo
    ' Load the data from a file.
    Private Sub LoadData()
    Dim fnum As Integer
    Dim fname As String
    Dim i As Integer    fnum = FreeFile
        fname = App.Path & "\books.txt"
        Open fname For Input As #fnum
        
        Input #fnum, MaxBook
        ReDim BookInfos(0 To MaxBook)    For i = 0 To MaxBook
            With BookInfos(i)
                Input #fnum, .Title, .ISBN, .URL
            End With
        Next i    Close #fnum
    End Sub
    ' Save the data into a file.
    Private Sub SaveData()
    Dim fnum As Integer
    Dim fname As String
    Dim i As Integer    fnum = FreeFile
        fname = App.Path & "\books.txt"
        Open fname For Output As #fnum    Write #fnum, MaxBook    For i = 0 To MaxBook
            With BookInfos(i)
                Write #fnum, .Title, .ISBN, .URL
            End With
        Next i    Close #fnum
    End Sub
    看一下这个吧
      

  2.   

    用StrConv转换一下吧.
    jj.nl = StrConv(1, vbUnicode)
      

  3.   

    改成如下格式Private Type BodyData
        xuhao As Integer
        nl As Integer
    End Type
    Private Sub Command1_Click()
        Dim jj As BodyData
        Dim filenum  As Integer
        filenum = 1
        If Dir("C:\user", vbDirectory) = "" Then MkDir "C:\user"
        Open "C:\user\abcd.txt" For Output As #filenum
        jj.xuhao = 1
        jj.nl = 1
        Write #filenum, , jj.nl, jj.xuhao
        Close #filenum
    End Sub
      

  4.   

    楼上,我的信誉高于90哦,回下贴好吗?
    http://community.csdn.net/Expert/topic/3641/3641840.xml?temp=.7611963
      

  5.   

    Open  "C:\PrintSet.dat" For Output As #1
     Write #1, "aaaaaa", "bbbbbb"
     Close #1