SEEK(filenumber) |
Returns the current read/write position within a file opened using the Open statement (Long). |
filenumber | The number of the file (Integer). |
REMARKS |
* This function returns the position based on a file opened with the Open subroutine. * The value returned is between 1 and 2,147,483,647. * If the file access mode is Random, then the number returned is the next record read or written. * If the file access mode is Binary, Output, Append or Input, then the byte position at which the next operation takes place is returned. * You can use the SEEK Statement to reposition where the next operation in a file will occur. * The equivalent .NET function is Microsoft.VisualBasic.FileSystem.Seek * For the Microsoft documentation refer to learn.microsoft.com |
Type Record
ID As Integer
Name As String
End Type
Dim myRecord As Record
Open "MyFile" For Random As #1 Len=Len(MyRecord)
Do While Not Eof(1)
Get #1, 1, myRecord
Debug.Print Seek(1)
Loop
VBA.Close #1
Dim myChar
VBA.Open "MyFile" For Input As #1
Do While Not Eof(1)
myChar = Input(1, #1)
Debug.Print Seek(1)
Loop
VBA.Close #1
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited Top