R
Regan
Hi the below function is to get a *.PGN file into a string. When i have a
small string it works good. But it doesn't seem to work with a long string.
Private Function GetPGN() As String
Dim strPath As String
Dim strFilter As String
Dim LngInputFile As Long
'Get location of *.PGN file
On Error GoTo ProcErr
strFilter = ahtAddFilterItem(strFilter, "PGN files (*.PGN)", "*.PGN")
strPath = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
'Put contents of *.PGN into string
LngInputFile = FreeFile
Open strPath For Input As LngInputFile
Line Input #LngInputFile, GetPGN
Debug.Print GetPGN
ProcExit:
Exit Function
ProcErr:
MsgBox "Error " & Err.Number & "(" & Err.Description & ")"
Resume ProcExit
End Function
Result in immediate window with small file =
[Event "Challenge from tfh_962"]
[Site "http://gameknot.com/chess.pl?bd=6944083"]
[Date "2007.03.18"]
[Round "-"]
[White "tfh_962"]
[Black "reganjackson"]
[Result "0-1"]
[WhiteElo "1736"]
[BlackElo "1200"]
[TimeControl "1/259200"]
[Mode "ICS"]
[Termination "normal"]
1. d4 Nf6 2. c4 e6 3. Nc3 Bb4 4. Qc2 O-O 5. a3 Bxc3+
6. bxc3 b6 7. e4 d6 8. Bd3 e5 9. f4 Nbd7 10. fxe5 dxe5
11. Nf3 Re8 12. O-O h6 13. Bb2 Nh5 14. c5 c6 15. cxb6 axb6
16. Nxe5 Nxe5 17. dxe5 Be6 18. Rad1 Qg5 19. c4 Bg4 20. Qf2 Bxd1
21. Qxf7+ Kh8 22. Rxd1 Nf4 23. Bf1 Ref8 24. Qd7 Nh3+ 25. Kh1
0-1
IT also works when there is 2 games
But when i have a *.pgn with 13 games with annotation all that pops up in
the immediate window is
1 line
[Event "Odyssey 2001"]
Can someone tell me what is wrong please
Cheers
--
Regan,
Paeroa
World famous in New Zealand
Message posted via AccessMonster.com
small string it works good. But it doesn't seem to work with a long string.
Private Function GetPGN() As String
Dim strPath As String
Dim strFilter As String
Dim LngInputFile As Long
'Get location of *.PGN file
On Error GoTo ProcErr
strFilter = ahtAddFilterItem(strFilter, "PGN files (*.PGN)", "*.PGN")
strPath = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
'Put contents of *.PGN into string
LngInputFile = FreeFile
Open strPath For Input As LngInputFile
Line Input #LngInputFile, GetPGN
Debug.Print GetPGN
ProcExit:
Exit Function
ProcErr:
MsgBox "Error " & Err.Number & "(" & Err.Description & ")"
Resume ProcExit
End Function
Result in immediate window with small file =
[Event "Challenge from tfh_962"]
[Site "http://gameknot.com/chess.pl?bd=6944083"]
[Date "2007.03.18"]
[Round "-"]
[White "tfh_962"]
[Black "reganjackson"]
[Result "0-1"]
[WhiteElo "1736"]
[BlackElo "1200"]
[TimeControl "1/259200"]
[Mode "ICS"]
[Termination "normal"]
1. d4 Nf6 2. c4 e6 3. Nc3 Bb4 4. Qc2 O-O 5. a3 Bxc3+
6. bxc3 b6 7. e4 d6 8. Bd3 e5 9. f4 Nbd7 10. fxe5 dxe5
11. Nf3 Re8 12. O-O h6 13. Bb2 Nh5 14. c5 c6 15. cxb6 axb6
16. Nxe5 Nxe5 17. dxe5 Be6 18. Rad1 Qg5 19. c4 Bg4 20. Qf2 Bxd1
21. Qxf7+ Kh8 22. Rxd1 Nf4 23. Bf1 Ref8 24. Qd7 Nh3+ 25. Kh1
0-1
IT also works when there is 2 games
But when i have a *.pgn with 13 games with annotation all that pops up in
the immediate window is
1 line
[Event "Odyssey 2001"]
Can someone tell me what is wrong please
Cheers
--
Regan,
Paeroa
World famous in New Zealand
Message posted via AccessMonster.com