No, se TU la salvi, si salva.
codice:
' Nel modulo .bas
Public sNomeSocieta As String
' Devi includere queste sub nel modulo.
' Questa Sub serve per salvare
Sub QuickSave(Dato As Variant, sPath As String, Modo As Integer)
Dim Buffer As Integer
Buffer = FreeFile
If Modo > 0 Then
Open sPath For Append As #Buffer
Else
Open sPath For Output As #Buffer
End If
Print #Buffer, Dato
Close #Buffer
End Sub
' Questa Sub serve per leggere
Sub QuickRead(Dato As Variant, sPath As String)
Dim Buffer As Integer
If Dir$(sPath) = "" Then
Dato = ""
Else
Buffer = FreeFile
Open sPath For Input As #Buffer
Line Input #Buffer, Dato
Close #Buffer
End If
End Sub
' Nel Form dove ti serve il valore di sNomeSocieta
' Nel Form_Unload(), per salvare il valore prima di uscire :
Call QuickSave(sNomeSocieta , App.Path & "\NomeSocieta.txt", 0)
' Nel Form_Load() per leggere il valore precedentemente salvato :
' Se esiste il file, ne leggi il contenuto
If Dir$(App.Path & "\NomeSocieta.txt") <> "" Then
' Il valore letto sarà in MiaVariabile
Call QuickRead(sNomeSocieta , App.Path & "\NomeSocieta.txt")
End If
Il codice è stato provato e collaudato centinaia di volte.
Ciao,