Raga io ho un problemadevo replicare il funzionamento di un notepad in vba in ambiente ACCESS io ho fatto 1 roba del genere :
Option Compare Database
Private Sub mnuApri_Click()
Dim strNomeFile As String
Dim strTesto As String
strNomeFile = InputBox("Nome e percorso file con sua estensione:")
Open strNomeFile For Input As #1
strTesto = Input(LOF(1), 1)
Close 1
txtFile = strTesto
End Sub
Private Sub MnuEsci_Click()
DoCmd.Close
End Sub
Private Sub MnuNuovo_Click()
Dim intRisposta As Integer
If blnTextChanged Then
intRisposta = MsgBox("Il testo è stato modificato." & _
"Vuoi salvare le modifiche?", _
vbYesNo + vbQuestion, "Conferma salvataggio")
If intRisposta = vbYes Then
MnuSalva_Click
Else
txtFile = ""
End If
Else
txtFile = ""
End If
blnTextChanged = False
End Sub
Private Sub MnuSalva_Click()
Dim strNomeFile As String
strNomeFile = InputBox("Inserisci il nome del file:")
Open strNomeFile For Output As #1
Print #1, txtFile
Close 1
End Sub
Private Sub Comando17_Click()
On Error GoTo Err_Comando17_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Comando17_Click:
Exit Sub
Err_Comando17_Click:
MsgBox Err.Description
Resume Exit_Comando17_Click
End Sub
Solo che mi sorgono 2 problemi , il primo , quando faccio nuovo , non mi domanda se voglio salvare il file , secondo , vorrei inserire un messaggio di errore nel caso uno tenti di aprire un file lasciando il campo vuoto ..
Grazie &![]()