Put# Statement
Escribe un registro en un archivo relativo o una secuencia de bytes en un archivo binario.
Use Print# statement to print data to a sequential text file. Use Write# statement to write data to a sequential text file with delimiting characters.

Put [#]fileNum, [recordNum|filePos], variable
fileNum: Any integer expression that defines the file that you want to write to.
recordNum, filePos: For relative files (random access files), the number of the record that you want to write.
En archivos binarios (acceso binario), la posición del byte del archivo en que se desee empezar a escribir.
variable: Name of the variable that you want to write to the file.
Nota para archivos relativos: Si el contenido de esta variable no coincide con la longitud del registro que se especifica en la cláusula Len de la instrucción Open, el espacio entre el final del registro escrito recientemente y el siguiente se rellena con los datos existentes del archivo al que está escribiendo.
Nota para archivos binarios: El contenido de las variables se escribe en la posición especificada y el puntero del archivo se inserta directamente después del último byte. No se deja espacio entre los registros.
Sub ExampleRandomAccess
Dim iNumber As Integer
Dim sText As Variant ' Debe ser un variant
Dim aFile As String
aFile = "C:\Users\ThisUser\data.txt"
iNumber = Freefile
Open aFile For Random As #iNumber Len=32
Seek #iNumero,1 ' Posición al principio
Put #iNumber, , "This is the first line of text" ' Fill line with text
Put #iNumber, , "This is the second line of text"
Put #iNumber, , "This is the third line of text"
Seek #iNumber,2
Get #iNumber, , sText
Print sText
Close #iNumber
iNumber = Freefile
Open aFile For Random As #iNumber Len=32
Get #iNumber, 2, sText
Put #iNumber, , "This is a new text"
Get #iNumber, 1, sText
Get #iNumber, 2, sText
Put #iNumber, 20, "This is the text in record 20"
Print Lof(#iNumber)
Close #iNumber
End Sub
Sub ExampleRandomAccess
Dim iNumber As Integer
Dim sText As Variant ' Must be a variant
Dim aFile As String
aFile = "~/data.txt"
iNumber = Freefile
Open aFile For Random As #iNumber Len=32
Seek #iNumber,1 ' Position at beginning
Put #iNumber, , "This is the first line of text" ' Fill line with text
Put #iNumber, , "This is the second line of text"
Put #iNumber, , "This is the third line of text"
Seek #iNumber,2
Get #iNumber, , sText
Print sText
Close #iNumber
iNumber = Freefile
Open aFile For Random As #iNumber Len=32
Get #iNumber, 2, sText
Put #iNumber, , "This is a new text"
Get #iNumber, 1, sText
Get #iNumber, 2, sText
Put #iNumber, 20, "This is the text in record 20"
Print Lof(#iNumber)
Close #iNumber
End Sub