rivate Sub Command3_Click()    Dim i As Integer
    Dim j As Integer
    Dim xlApp As Excel.Application
    Dim xlBook As Excel.Workbook
    Dim xlSheet As Excel.Worksheet
    Set xlApp = CreateObject("Excel.Application")
    xlApp.Visible = True
    Set xlBook = xlApp.Workbooks.Add
    Set xlSheet = xlBook.Worksheets(1)
    xlSheet.Cells(6, 1) = "i"
    For i = 0 To gridrow
     Grid1.row = i
     For j = 0 To 6
      Grid1.col = j
      If IsNull(Grid1.Text) = False Then
    xlSheet.Cells(i + 5, j + 1) = Grid1.Text
      End If 哥哥们 这个说我gridrow 没定义 什么情况啊 ?

解决方案 »

  1.   

    rivate Sub Command3_Click()     Dim i As Integer 
        Dim j As Integer
        dim gridrow as integer 
        Dim xlApp As Excel.Application 
        Dim xlBook As Excel.Workbook 
        Dim xlSheet As Excel.Worksheet 
        Set xlApp = CreateObject("Excel.Application") 
        xlApp.Visible = True 
        Set xlBook = xlApp.Workbooks.Add 
        Set xlSheet = xlBook.Worksheets(1) 
        xlSheet.Cells(6, 1) = "i" 
        For i = 0 To gridrow 
        Grid1.row = i 
        For j = 0 To 6 
          Grid1.col = j 
          If IsNull(Grid1.Text) = False Then 
        xlSheet.Cells(i + 5, j + 1) = Grid1.Text