ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] VB6 MSFlexGrid ¤¸¥ó¸ê®Æ¶×¦Ü excel°ÝÃD

[µo°Ý] VB6 MSFlexGrid ¤¸¥ó¸ê®Æ¶×¦Ü excel°ÝÃD

VB6 ¤¤ ¦³ MSFlexGrid ¤¸¥ó ¤º¸ê®Æ¦b¶×¥X¦ÜExcel ¬O
¤@¯ë¼Ò¦¡³£¬O¥Î°j°é¤è¦¡(µ{¦¡½X¦p¤U)
    For i = 0 To MSFlexGrid1.Rows - 1
        For jNo = 0 To MSFlexGrid1.Cols - 1
          wshExcel.Cells(i + 1, j + 1) =  MSFlexGrid1.TextMatrix(i, j)
        Next cNo
     Next rNo

½Ð°Ý¦U¦ì¤j¤j¡A­n¦p¦óÅý MSFlexGrid¥i¥H¹³listbox¤¸¥ó¤@¼Ë¥i¥Hª½±µ¶K¤W
Listboxµ{¦¡½X¦p¤U
    Set MyXlsApp = CreateObject("Excel.Application")
    MyXlsApp.Visible = True
    Set xlbook = MyXlsApp.Workbooks.Add
    Set xlsheet1 = xlbook.Worksheets(1)

    xlsheet1.Cells(1, 1).Value = "²£«~§Ç¸¹"
    xlsheet1.Cells(1, 2).Value = "¥\²v"
    xlsheet1.Cells(1, 3).Value = "¥þ¶Z"
    xlsheet1.Cells(1, 4).Value = "ÀËÅç®É¶¡"
   
    xlsheet1.Range(xlsheet1.Cells(1, 1), xlsheet1.Cells(UserForm1.ListBox1.ListCount, UserForm1.ListBox1.ColumnCount)).Offset(1, 0) = UserForm1.ListBox1.List

¨Ò¦p

xlsheet1.Range(x,y),offset)1,0)=MSFlexGrid1.XXXXXXX
¬O¾Çµ{¦¡¦Ó¤£¬O­nµ{¦¡¡A¬O¶i¨Bªº°ò¦

¤£¦n·N«ä~ §Úªº¤è¦¡¤]¬O¥Î°j°é¤@­Ó¤@­Ó¨ú...
¥i¯àÀ°¤£¤W¤°»ò¦£...
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¶{¤j¤j¥X²{¤F¡A¨þ¨þ
§Ú¤]¦b¨ä¥Lºô¯¸§ä¤F«Ü¤[¡A¤]³£¬O¥Î¦^°éªº¤è¦¡
¬O¾Çµ{¦¡¦Ó¤£¬O­nµ{¦¡¡A¬O¶i¨Bªº°ò¦

TOP

¶{¤j¤j¥X²{¤F¡A¨þ¨þ
§Ú¤]¦b¨ä¥Lºô¯¸§ä¤F«Ü¤[¡A¤]³£¬O¥Î¦^°éªº¤è¦¡
·t¶Â µoªí©ó 2010/6/29 10:44 AM


¨þ¨þ¨þ~ ¯u¤£¦n·N«ä!¦]¬°¤p§Ì¨S¦³§ó¦nªº¤è¦¡... ³£¤£´±¥X²{!
¦pªG·t¶Â¥S±z¬ã¨s¥X§ó§Öªº¤è¦¡¡A¤]½Ð·t¶Â¥S±z¤£¶Þ«ü¾É~
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

'没¨ä¥¦ªº办ªk¡A¥u¯à¥Î´`环ªº¤è¦¡读¥X数Õu¡A这©MListView±±¥ó®t¤£¦h¡C¤£过¥i¥H¥ý将数Õu读¤J数组¡A¦A³q过数组写¤JExcel,毕³ºExcelªºVBA¬O³Ì§Ò讳³v单¤¸®æ¾Þ§@ªº¡C
Dim arr(), lRow, lCol
Dim i, j
lRow = MSFlexGrid1.Rows
lCol = MSFlexGrid1.Cols
ReDim arr(1 To lRow, 1 To lCol)
For i = 0 To lRow - 1
    For j = 0 To lCol - 1
        arr(i + 1, j + 1) = MSFlexGrid1.TextMatrix(i, j)
    Next
Next
xlsheet1.Range("a1").Resize(lRow, lCol) = arr

TOP

        ÀR«ä¦Û¦b : ¤H­n¦Û·R¡A¤~¯à·R´¶¤Ñ¤Uªº¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD