写入已经会了,然后需要显示这个excel,用ole可以,但是没有滚动条,也不能单独打印这个ole
最好是有打印预览

解决方案 »

  1.   

    其实应用一个好的网格控件,也是可以达到你的目的的。如MSHFLEXGRID,VSFLEXGRID7等等。
      

  2.   

    放一个ole控件OLE1.SourceDoc = App.Path & "\cc.xls"OLE1.Action = 1    'use the old action method
    OLE1.SizeMode = vbOLESizeAuttoSize    '调节对象大小使其正好充满OLE容器控件具体的看msdn
      

  3.   

    用ole控件load近来就行了如果不是镶嵌的化可以直接考虑shell出EXCEL
      

  4.   

    OLE 
    有嵌套 连接两种 任你选择
      

  5.   

    给你一个很好的控件
    http://support.microsoft.com/default.aspx?scid=kb;en-us;311765
      

  6.   

    用ole嵌入来显示,自己模拟两个滚动条,打印预览和打印就调用excel,可以不让excel显示出来的,代码如下:
    Private Sub Command1_Click()
        'oleTest.Action = 7
        Dim xlApp As Excel.Application
        Set xlApp = New Excel.Application
        Set xlApp = CreateObject("Excel.Application")
        xlApp.WindowState = xlMaximized
        
        xlApp.Visible = False
        Set xlBook = xlApp.Workbooks.Open(strPrintFileName)
        Set xlsheet = xlBook.Worksheets(1)
        
        
        xlApp.Visible = True
        On Error Resume Next
        xlsheet.PrintPreview
        xlApp.Visible = False
        xlBook.Save
        xlApp.Quit
        
    End Sub
      Private Sub Command2_Click()
        'oleTest.Action = 7
        Dim xlApp As Excel.Application
        Set xlApp = New Excel.Application
        Set xlApp = CreateObject("Excel.Application")
        xlApp.Visible = False
        Set xlBook = xlApp.Workbooks.Open(strPrintFileName)
        Set xlsheet = xlBook.Worksheets(1)
        On Error Resume Next
        xlsheet.PrintOut
        xlApp.Quit
    End SubPrivate Sub Command3_Click()
        Unload Me
    End SubPrivate Sub Form_Load()
        
        oleTest.CreateLink strPrintFileName
        oleTest.SizeMode = 0
        If oleTest.Width > picTest.ScaleWidth Then
            hslTest.Max = oleTest.Width - 2
            hslTest.LargeChange = picTest.ScaleWidth
            hslTest.SmallChange = hslTest.Max - hslTest.LargeChange
        Else
            hslTest.Enabled = False
            oleTest.Width = picTest.ScaleWidth + 2
        End If
        
        If oleTest.Height > picTest.ScaleHeight Then
            vslTest.Max = oleTest.Height - 2
            vslTest.LargeChange = picTest.ScaleHeight
            vslTest.SmallChange = vslTest.Max - vslTest.LargeChange
        Else
            vslTest.Enabled = False
            oleTest.Height = picTest.ScaleHeight + 2
        End If
        
        'MsgBox oleTest.Height & "     " & picTest.ScaleHeight
    End SubPrivate Sub hslTest_Change()
        Call hslTest_Scroll
    End SubPrivate Sub hslTest_Scroll()
        oleTest.Left = (picTest.ScaleWidth - hslTest.Max) * (hslTest.Value / hslTest.Max) - 1
        
    End SubPrivate Sub vslTest_Change()
        Call vslTest_Scroll
        
    End SubPrivate Sub vslTest_Scroll()
        oleTest.Top = (picTest.ScaleHeight - vslTest.Max) * (vslTest.Value / vslTest.Max) - 1
    End Sub