求MSFLEXGRID控件数据打印代码。本人程序里多处用到MSFLEXGRID控件,现在想打印MSFLEXGRID控件里生成的数据,有打印预览功能更好,请帮忙!!!

解决方案 »

  1.   

    DataReport或者是第三方控件....
    沒有其它的了
      

  2.   

    DataReport是什么?VB自己的控件?楼上的能不能说清楚点啊?谢谢了
      

  3.   

    DataReport 是vb 自带的报表设计器。
      

  4.   

    DataReport能和MSFLEXGRID控件挂上钩?
      

  5.   

    我也是: 导出到EXCEL中再打印   :)
      

  6.   

    导出到EXCEL中再打印
    Set xlapp = CreateObject("excel.application")
        
          If (xlapp = Null) Then
          MsgBox ("无法创建Excel对象,可能您的机子未安装Excel")
          End If
          
         Dim xlBook As Object
         Dim xlSheet As Object
         xlapp.Visible = True     Set xlBook = xlapp.Workbooks.Add()
         Set xlSheet = xlBook.Worksheets(1)
         j = infolist.Columns.Count
         xlSheet.Cells(1, 1) = rswage!Fields(年份) & "年" & rswage!Fields(月份) & "月" & "员工明细工资表"
         i = 1
         For n = 1 To j - 1
            If infolist.Columns(n).Visible = True Then
                xlSheet.Cells(2, i) = infolist.Columns(n).Caption
                i = i + 1
            End If
         Next n
         rswage3.MoveFirst
         m = 0
         Do While Not rswage3.EOF
            i = 1
            For n = 1 To j - 1
               If infolist.Columns(n).Visible = True Then
                   xlSheet.Cells(m + 3, i) = infolist.Columns(n).Value
                   i = i + 1
               End If
            Next n
            rswage3.MoveNext
            m = m + 1
           Loop
           Exit Sub