Excel Codice VBA rimosso dopo salvataggio

Anonimo
2015-08-09T15:21:58+00:00

Buongiorno,

ho creato un foglio di lavoro (con Excel 2013 su di un computer con WIndows 8.1. ) con diverso codice Vba ed alcuni bottoni. Dopo il salvataggio in formato .xlsm, ho testato il fuzionamento ed era corretto. Ho quindi copiato il file su di un computer con Windows XP ed Office 2007, anche qui il funzionamento è corretto. Dopo il salvataggio sul computer con xp però il file perde tutto il suo codice (alla riapertura del file stesso i pulsanti non funzionano più e se cerco di vedere il codice mi viene segnalato un errore di ddl non trovata e mostrata la schermata del codice bianca e vuota).  A cosa può essere dovuto l'errore? Esiste un workaround a  questo(Non posso cambiare ne sistema operativo ne suite di office)?

Microsoft 365 e Office | Excel | Per la casa | Windows

Domanda bloccata. Questa domanda è stata eseguita dalla community del supporto tecnico Microsoft. È possibile votare se è utile, ma non è possibile aggiungere commenti o risposte o seguire la domanda.

0 commenti Nessun commento

4 risposte

Ordina per: Più utili
  1. Anonimo
    2015-08-14T20:31:37+00:00

    Private Sub Cancella_Click()

    Dim targa As String

    Dim i As Integer

    targa = Cells(11, "D").Value

    If ((targa = "") Or (IsEmpty(Cells(11, "D").Value))) Then Exit Sub

    i = 1

    Do While ((Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value)) And (VBA.UCase(Sheets("Elenco").Cells(i, "C").Value) <> VBA.UCase(targa)))

        i = i + 1

    Loop

    Dim answer As Integer

    answer = MsgBox("Sei sicuro di voler eliminare il veicolo targato '" + targa + "'?", vbYesNo + vbQuestion, "Elimina")

    If answer = vbYes Then

    Sheets("Elenco").Rows(i).Delete

     Cells(9, "D").Value = ""

        Cells(10, "D").Value = ""

        Cells(11, "D").Value = ""

        Cells(12, "D").Value = ""

        Cells(15, "E").Value = ""

        Cells(17, "E").Value = ""

        Cells(18, "E").Value = ""

        Cells(19, "E").Value = ""

        Cells(20, "E").Value = ""

        Cells(21, "E").Value = ""

        Cells(30, "E").Value = ""

        Cells(31, "E").Value = ""

        Cells(32, "E").Value = ""

        Cells(34, "E").Value = ""

        End If

    End Sub

    Private Sub Cerca_Click()

    Dim targa As String

    targa = Cells(11, "D").Value

    If ((targa = "") Or (IsEmpty(Cells(11, "D").Value))) Then Exit Sub

    Dim i As Integer

    i = 1

    Do While ((Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value)) And (VBA.UCase(Sheets("Elenco").Cells(i, "C").Value) <> VBA.UCase(targa)))

        i = i + 1

    Loop

    If Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value) Then

        Cells(9, "D").Value = Sheets("Elenco").Cells(i, "A").Value

        Cells(10, "D").Value = Sheets("Elenco").Cells(i, "B").Value

        Cells(11, "D").Value = Sheets("Elenco").Cells(i, "C").Value

        Cells(12, "D").Value = Sheets("Elenco").Cells(i, "D").Value

        Cells(15, "E").Value = Sheets("Elenco").Cells(i, "E").Value

        Cells(17, "E").Value = Sheets("Elenco").Cells(i, "F").Value

        Cells(18, "E").Value = Sheets("Elenco").Cells(i, "G").Value

        Cells(19, "E").Value = Sheets("Elenco").Cells(i, "H").Value

        Cells(20, "E").Value = Sheets("Elenco").Cells(i, "I").Value

        Cells(21, "E").Value = Sheets("Elenco").Cells(i, "J").Value

        Cells(30, "E").Value = Sheets("Elenco").Cells(i, "P").Value

        Cells(31, "E").Value = Sheets("Elenco").Cells(i, "Q").Value

        Cells(32, "E").Value = Sheets("Elenco").Cells(i, "R").Value

        Cells(34, "E").Value = Sheets("Elenco").Cells(i, "S").Value

        Sheets("Redditività Usato").ComboBox1.Value = Sheets("Elenco").Cells(i, "T").Value

    Else

        MsgBox "Impossibile trovare la targa richiesta"

    End If

    End Sub

    Private Sub Salva_Click()

    Dim targa As String

    Dim i As Integer

    targa = Cells(11, "D").Value

    If ((targa = "") Or (IsEmpty(Cells(11, "D").Value))) Then Exit Sub

    i = 1

    Do While ((Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value)) And (VBA.UCase(Sheets("Elenco").Cells(i, "C").Value) <> VBA.UCase(targa)))

        i = i + 1

    Loop

    If Not IsEmpty(Sheets("Elenco").Cells(i, "C").Value) Then

    Dim answer As Integer

    answer = MsgBox("Sovrascrivere i dati del veicolo targato '" + targa + "'?", vbYesNo + vbQuestion, "Salva")

    If answer = vbNo Then Exit Sub

     End If

        Sheets("Elenco").Cells(i, "A").Value = Cells(9, "D").Value

        Sheets("Elenco").Cells(i, "B").Value = Cells(10, "D").Value

        Sheets("Elenco").Cells(i, "C").Value = Cells(11, "D").Value

        Sheets("Elenco").Cells(i, "D").Value = Cells(12, "D").Value

        Sheets("Elenco").Cells(i, "E").Value = Cells(15, "E").Value

        Sheets("Elenco").Cells(i, "F").Value = Cells(17, "E").Value

        Sheets("Elenco").Cells(i, "G").Value = Cells(18, "E").Value

        Sheets("Elenco").Cells(i, "H").Value = Cells(19, "E").Value

        Sheets("Elenco").Cells(i, "I").Value = Cells(20, "E").Value

        Sheets("Elenco").Cells(i, "J").Value = Cells(21, "E").Value

          Sheets("Elenco").Cells(i, "K").Formula = "=G" & i & "+H" & i & "+I" & i & "+J" & i

        Sheets("Elenco").Cells(i, "L").Formula = "=F" & i & "+K" & i

        Sheets("Elenco").Cells(i, "M").Formula = "=K" & i & "/F" & i

        Sheets("Elenco").Cells(i, "N").Formula = "=K" & i & "/E" & i

        Sheets("Elenco").Cells(i, "O").Formula = "=E" & i & "-(L" & i & "+P" & i & "+Q" & i & "+R" & i & "+S" & i & ")"

     Sheets("Elenco").Cells(i, "U").Value = Date

        Sheets("Elenco").Cells(i, "P").Value = Cells(30, "E").Value

        Sheets("Elenco").Cells(i, "Q").Value = Cells(31, "E").Value

        Sheets("Elenco").Cells(i, "R").Value = Cells(32, "E").Value

        Sheets("Elenco").Cells(i, "S").Value = Cells(34, "E").Value

        Sheets("Elenco").Cells(i, "A").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "B").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "C").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "D").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "E").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "F").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "G").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "H").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "I").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "J").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "K").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "L").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "M").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "N").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "O").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "P").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "Q").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "R").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "S").Borders.LineStyle = xlContinuous

         Sheets("Elenco").Cells(i, "T").Borders.LineStyle = xlContinuous

          Sheets("Elenco").Cells(i, "U").Borders.LineStyle = xlContinuous

        Sheets("Elenco").Cells(i, "T").Value = Sheets("Redditività Usato").ComboBox1.Value

    End Sub

    Private Sub Worksheet_Activate()

        Dim i As Integer

        i = 2

        Sheets("Redditività Usato").ComboBox1.Clear

        Do While ((Not IsEmpty(Sheets("Venditori").Cells(i, "A").Value)))

            Sheets("Redditività Usato").ComboBox1.AddItem Sheets("Venditori").Cells(i, "A").Value

            i = i + 1

        Loop

        Sheets("Redditività Usato").ComboBox1.ListIndex = 0

    End Sub

    La risposta è stata utile?

    0 commenti Nessun commento
  2. Anonimo
    2015-08-12T07:23:07+00:00

    Unica modifica che ho dovuto fare al file è stata appore davanti alla funzione Date() il prefisso VBA (altrimenti mi dava un errore).

    Non ho capito.

    Posta, per favore, il pezzo di codice.

    Grazie.

    La risposta è stata utile?

    0 commenti Nessun commento
  3. Anonimo
    2015-08-11T19:41:01+00:00

    Salve, 

    il contesto è composto semplicemente da due fogli uno contiene una "maschera" di inserimento dati con un bottone salva (bottone del tipo controllo  activeX). Per salvare scorro il secondo foglio fino a quando non trovo una cella bianca ed inserisco il valore.

    Il fatto è che il tutto funziona correttamente anche su xp fino a quando non faccio il salvataggio.

    Unica modifica che ho dovuto fare al file è stata appore davanti alla funzione Date() il prefisso VBA (altrimenti mi dava un errore).

    La risposta è stata utile?

    0 commenti Nessun commento
  4. Anonimo
    2015-08-10T07:29:10+00:00

    Difficile rispondere senza conoscere TUTTO il contesto nel quale operi.

    Non dovrebbe accadere quando esponi. Sicuro di non utilizzare oggetti non compatibili con versioni differenti da quella utilizzata per creare il file? Considera che Office 2013 NON è compatibile con Windows XP. Però, ripeto, se non hai utilizzato oggetti particolari office 2007 di XP non dovrebbe dare problemi.

    La risposta è stata utile?

    0 commenti Nessun commento