Visualizzazione dei risultati da 1 a 4 su 4

Discussione: [VBA] Notepad

  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    185

    [Visual Basic] Notepad

    Raga io ho un problema devo 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 &

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    185
    lo posto 1 po più leggibile

    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

  3. #3
    esiste il subforum apposito per il VB e il VBA...
    ...Terrible warlords, good warlords, and an english song

  4. #4
    Utente di HTML.it L'avatar di JamesD
    Registrato dal
    Oct 2001
    Messaggi
    415
    Originariamente inviato da D€Vil
    lo posto 1 po più leggibile
    ....
    se realmente lo vuoi fare usa il tag code :quipy:

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.