投稿日 | : 2003/07/09(Wed) 13:06 |
投稿者 | : 匿名 |
Eメール | : |
URL | : |
タイトル | : Re^7: ファイルの分割表示の質問 |
DatNを有効に使うとこんな感じですかね。
Private Sub sFileOpen()
'データ読み込み表示処理'
Dim name As String '名前'
Dim Shot As String 'シュート回数'
Dim ThreePShot As String '3ポイントシュート成功回数'
Dim TwoPShot As String '2ポイントシュート成功回数'
Dim FreeThrow As String 'フリースロー成功回数'
Dim Soutokuten As String '総得点'
Dim Rebound As String 'リバウンド獲得回数'
Dim Assist As String 'アシスト成功回数'
Dim Steel As String 'スティール成功回数'
Dim BlockShot As String 'ブロックショット成功回数'
Dim Foul As String 'ファウル回数'
Dim DatN As Integer 'データのカウント'
Dim intFileNo As Integer 'ファイルナンバー'
Dim i As Integer
Dim j As Integer
'キャンセルボタンが押されたらエラーとして通知'
CommonDialog1.CancelError = True
'エラーが起きたら最終行へ'
On Error GoTo Cancel_exit
'フィルターは「*.csv」'
CommonDialog1.Filter = "シート (*.csv)|*.csv"
'ダイアログボックスの形を決める'
CommonDialog1.Flags = cdlOFNExplorer Or cdlOFNFileMustExist Or _
cdlOFNHideReadOnly Or cdlOFNLongNames Or cdlOFNNoChangeDir
'ファイルを開くを表示'
CommonDialog1.ShowOpen
'ファイル名をfile_nameにセット'
file_name = CommonDialog1.FileName
DatN = 0
intFileNo = FreeFile
Open file_name For Input As #intFileNo
Do Until EOF(intFileNo)
Input #intFileNo, name, Shot, ThreePShot, TwoPShot, FreeThrow, _
Soutokuten, Rebound, Assist, Steel, BlockShot, Foul
With MSFlexGrid2(DatN \ 5)
.Visible = False '一旦非表示にする'
.FillStyle = flexFillRepeat
'読み込んだデータをセルに代入'
.Rows = 5 + 2
.Row = (DatN Mod 5) + 1
.RowHeight((DatN Mod 5) + 1) = 350
.TextMatrix(.Row, 0) = Format$(DatN + 1, "##0")
.TextMatrix(.Row, 1) = Format$(name, "####0")
.TextMatrix(.Row, 2) = Format$(Shot, "####0")
.TextMatrix(.Row, 3) = Format$(ThreePShot, "####0")
.TextMatrix(.Row, 4) = Format$(TwoPShot, "####0")
.TextMatrix(.Row, 5) = Format$(FreeThrow, "####0")
.TextMatrix(.Row, 6) = Format$(Soutokuten, "####0")
.TextMatrix(.Row, 7) = Format$(Rebound, "####0")
.TextMatrix(.Row, 8) = Format$(Assist, "####0")
.TextMatrix(.Row, 9) = Format$(Steel, "####0")
.TextMatrix(.Row, 10) = Format$(BlockShot, "####0")
.TextMatrix(.Row, 11) = Format$(Foul, "####0")
End With
DatN = DatN + 1
Loop
Close #intFileNo
With MSFlexGrid2(0)
'カレントセルをホームポジションに'
.FillStyle = flexFillSingle
.Row = 1
.Col = 1
.Visible = True '再表示'
.SetFocus
End With
With MSFlexGrid2(1)
'カレントセルをホームポジションに'
.FillStyle = flexFillSingle
.Row = 1
.Col = 1
.Visible = True '再表示'
.SetFocus
End With
'ファイル名を表示する'
frmGameStats.Caption = file_name
Exit Sub
'エラー処理'
Cancel_exit:
MsgBox Err.Description
End Sub