Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

VB MSFlexGrid 輸出問題

我在 MSFlexGrid 輸入了N筆的資料

我想把他輸出到.TXT文字檔中

請問我要如何寫語法

[ ] 代表 MSFlexGrid 的格子

例如 :

[100] [101] [102]

[103] [104] [105]

我要把這幾筆的資料輸出至.TXT檔中

會顯示成 :

100 101 102

103 104 105

會依照在MSFlexGrid 輸入的位子顯示在.TXT檔中

Update:

謝謝你~不過為什麼他輸出都會把最後依個顯示在最上面

例如我打了 01 02 03 04 05

他會顯示成

05

01 02 03 04 05

如果我要把MSFlexGrid的第一行第一列(灰色的地方)都打上名子固定

能辦的到嗎

1 Answer

Rating
  • W.J.S.
    Lv 7
    1 decade ago
    Favorite Answer

    Private Sub Command1_Click()

    Dim S As String, R As Integer, C As Integer

    With MSFlexGrid1

    For R = 0 To .Rows - 1

    For C = 0 To .Cols - 1

    S = S & .TextMatrix(R, C) & " "

    Next

    S = Left(S, Len(S) - 1) & vbCrLf

    Next

    '除去最後一個換行字元

    S = Left(S, Len(S) - 2)

    End With

    '儲存至"C:\test.txt"(請把\改成半型)

    Open "C:\test.txt" For Output As #1

    Print #1, S

    Close #1

    End Sub

    2007-08-16 12:53:09 補充:

    我跑起來沒有問題ㄋㄟ,我把怎個專案給你(只能放7天),你參考看看

    http://www.yousendit.com/transfer.php?action=check...

    MSFlexGrid本身是無法記錄,故你必須在程式裡面把值寫上.

Still have questions? Get your answers by asking now.