You can store the string in a file as described by VBOffice.
http://www.vboffice.net/en/developer...and-save-files
Public Function ReadFile(sPath As String) As String
' http://www.vboffice.net/en/developers/open-and-save-files
On Error GoTo AUSGANG
Dim lFileNr As Long
Dim sText As String
lFileNr = FreeFile
Open sPath For Binary As #lFileNr
sText = Space$(LOF(lFileNr))
Get #lFileNr, , sText
AUSGANG:
If lFileNr Then Close #lFileNr
If Err.Number Then Err.Raise Err.Number, Err.Source, Err.Description
ReadFile = sText
End Function
Public Sub WriteFile(sPath As String, _
sText As String, _
Optional ByVal bAppend As Boolean _
)
On Error GoTo AUSGANG
Dim lFileNr As Long
lFileNr = FreeFile
Select Case bAppend
Case False
Open sPath For Output As #lFileNr
Case Else
Open sPath For Append As #lFileNr
End Select
Print #lFileNr, sText;
AUSGANG:
If lFileNr Then Close #lFileNr
If Err.Number Then Err.Raise Err.Number, Err.Source, Err.Description
End Sub
Not specific to the question. Example usage, to generate consecutive numbers.
http://www.vboffice.net/en/developer...2&cmd=showitem
Public Function GetNextID() As Long
' http://www.vboffice.net/en/developers/create-a-serial-number/?mnu=2&cmd=showitem
Dim lCurrID As Long
Dim File As String
File = "C:Sample.txt"
lCurrID = Val(ReadFile(File))
lCurrID = lCurrID + 1
WriteFile File, CStr(lCurrID), False
GetNextID = lCurrID
End Function