急救!求msflexgrid 的打印源码?????
要求:
  我要的是只显示内容数据,不要表格及其它,
   打印msflexgrid表中所有内容!
   请高手解难!!
   急需!!

解决方案 »

  1.   

    1、
    这里有一个快速打印MSFlexGrid控件内容的方法:   Printer.PaintPicture MSFlexGrid_Name.Picture, 0, 0 
    Printer.EndDoc   如果想打印满页面的整个长度,请在前面添加下面2个语句:   Dim old_width as Integer 
    MSFlexGrid_Name.width=printer.width    然后,再在尾部添加:   MSFlexGrid_Name.width=old_width 
    ------------------------------
    2、引用Excel 
    Dim xlsApp As Excel.Application
    Dim xlsBook As Excel.Workbook
    Dim xlssheet As Excel.Worksheet
    Set xlsApp = New Excel.Application
    Set xlsApp = CreateObject("Excel.Application")   
    xlsApp.Visible = False                           
    Set xlsBook = xlsApp.Workbooks.Open(app.path & "\filename.xls") 
    Set xlssheet = xlsBook.Worksheets(1)            
    for i=1 to mshflexgrid.rows
       for j=1 to mshflexgrid.cols
        With xlssheet
            mshflexgrid.row=i
            mshflexgrid.col=j
            .Cells(i, j) = mshflexgrid.text
        End With
       next j
    next i
    xlsBook.Save
    xlssheet.PrintPreview 
    xlsApp.Quit
    Set rsExesList = Nothing
    Set cnExesList = Nothing
    Set xlsApp = Nothing
    Set xlsBook = Nothing
    Set xlssheet = Nothing