FATTURE



  • FATTURE
    di NICOLA (utente non iscritto) data: 16/05/2016 10:24:41

    Ciao a tuti,
    avevo predisposto qualche settimana fa, grazie ad un utente del sito, delle macro per salvare e stampare delle fatture.
    In pratica:
    - sulla base di un database che viene continuamente aggiornato in base allo stato delle fatture, avevo predisposto due macro per stampare in PDF le fatture con RICEVUTA BANCARIA e/o BONIFICO BANCARIO;
    - se nella colonna "E" compare la scritta "DA EMETTERE" e nella colonna "G" la scritta "RICEVUTA BANCARIA" la macro compilava il folgio "MasterRIBA" e salvava il PDF
    - se nella colonna "E" compare la scritta "DA EMETTERE" e nella colonna "G" la scritta "BONIFICO BANCARIO" la macro compilava il folgio "MasterBON" e salvava il PDF

    Ovviamnete possono esserci più fatture con dicitura "RICEVUTA BANCARIA" e più fatture con dictura "BONIFICO BANCARIO", oppure solo di una di queste categorie.

    Purtroppo non funziona più.

    Qualcuno riesce a dirmi perchè ???

    Grazie mille



  • di Marius44 data: 16/05/2016 10:39:47

    Ciao Nicola
    All'apertura del tuo file mi dice che "una parte è illeggibile o corrotta"; sono riuscito ad aprirlo comunque ma, ovviamente, non funziona.
    Ho notato però che in entrambe le macro che lanciano la stampa manca un "End If" prima di Next X. Forse il file, inavvertitamente, è stato manipolato?

    Prova mettere quell' End If e vedi se funziona.
    Ciao,
    Mario


  • risposta
    di NICOLA (utente non iscritto) data: 16/05/2016 11:22:59

    Ho provato a riallegare il file togliendo quello che non c'entra per quello che ho chiesto.
    Se mendo End If come mi hai detto mi da errore.
    Riesci ad aprire il file ed a verificare cosa c'è di sbagliato nelle due macro ?
    In alternativa, si potrebbe impostare anche una sola macro, che quando trova "BONIFICO BANCARIO" nella colonna "G" compila e salva in PDF il foglio "MasterBON" e quando trova "RICEVUTA BANCARIA" compila e salva in PDF il foglio "MasterRIBA".


    Help !!!!!!


  • HELP
    di NICOLA (utente non iscritto) data: 16/05/2016 16:09:11

    Scusate,
    qualcuno riesce ad aiutarmi nel sistemare le macro?

    Grazie mille



  • di Albatros54 data: 16/05/2016 18:22:53

    Ho scaricato il file"Scadenziari_fattura_clienti",ho lancia il codice tramite il pulsante"Stampa PDF fatture", e mi dava errore.L'errore che ho riscontrato sta nella Variabile PERCORSO,che non trova la cartella"Fatture-Stampate", ho creato questa cartella nel path del file è il tutto funziona, mi stampa le fatture in Pdf.
    Prova a cambiare il percorso
    ciao
    albatros54






  • di Mister_x (utente non iscritto) data: 16/05/2016 18:31:09

    ciao

    io invece ho riscontrato un errore sul If , lavoro inutile

    ciao


     
    Sub ARCHIVIARIBA()
    Dim X, Rr, Rg As Object
    Ur = Sheets("Fatture").Range("A" & Rows.Count).End(xlUp).Row
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
        For X = 7 To Ur
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''
            If Sheets("Fatture").Cells(X, 2) = "DA EMETTERE" And _
               Sheets("Fatture").Cells(X, 7) = "RICEVUTA BANCARIA" Then  ''inizio controllo
                Set Rg = Sheets("Fatture").Cells(X, 1)
                Rr = Rg.Row
                Sheets("MasterRIBA").Cells(17, 8) = Sheets("Fatture").Cells(1, 1) + 1
                Sheets("MasterRIBA").Cells(17, 10) = Sheets("Fatture").Cells(X, 5)
                Sheets("MasterRIBA").Cells(18, 5) = Sheets("Fatture").Cells(X, 1)
                Sheets("MasterRIBA").Cells(19, 5) = Sheets("Fatture").Cells(X, 19)
                Sheets("MasterRIBA").Cells(20, 5) = Sheets("Fatture").Cells(X, 20)
                Sheets("MasterRIBA").Cells(21, 6) = Sheets("Fatture").Cells(X, 21)
                Sheets("MasterRIBA").Cells(25, 2) = Sheets("Fatture").Cells(X, 9)
                Sheets("MasterRIBA").Cells(25, 10) = Sheets("Fatture").Cells(X, 11)
                Sheets("MasterRIBA").Cells(27, 10) = Sheets("Fatture").Cells(X, 12)
                Sheets("MasterRIBA").Cells(28, 10) = Sheets("Fatture").Cells(X, 13)
                Sheets("MasterRIBA").Cells(29, 10) = Sheets("Fatture").Cells(X, 14)
                Sheets("MasterRIBA").Cells(30, 10) = Sheets("Fatture").Cells(X, 15)
                Sheets("MasterRIBA").Cells(35, 5) = Sheets("Fatture").Cells(X, 16)
                Sheets("MasterRIBA").Cells(34, 5) = Sheets("Fatture").Cells(X, 7)
                Sheets("MasterRIBA").Cells(32, 5) = Sheets("Fatture").Cells(X, 22)
                Sheets("MasterRIBA").Cells(33, 6) = Sheets("Fatture").Cells(X, 18)
                Sheets("Fatture").Cells(1, 1) = Sheets("Fatture").Cells(1, 1) + 1
                Sheets("Fatture").Cells(2, 9).Copy
                Sheets("Fatture").Cells(X, 2).PasteSpecial
                Sheets("Fatture").Cells(X, 3) = Sheets("Fatture").Cells(1, 1)
                ' salvo PDF
        Dim strFile As String
        Dim PERCORSO As String
        PERCORSO = ThisWorkbook.Path & "Fatture-Stampate"
        Set ws = Sheets("MasterRIBA")
         strFile = Sheets("Fatture").Cells(1, 1) & "_" & "2016" & "-" & Sheets("MasterRIBA").Cells(18, 5) & " (" & Sheets("MasterRIBA").Cells(25, 2) & ")" & ".pdf"
        Sheets("MasterRIBA").ExportAsFixedFormat Type:=xlTypePDF, Filename:=PERCORSO & strFile, Quality:= _
            xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
            OpenAfterPublish:=False
     End If  ''termina  (If)
     '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ' Stampa
                
                'inserire codice stampa
                
                ' non cancello nulla dato che alla prossima viene ricalcolato
               
               Next X
               
    Fine:
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    MsgBox "CREATI File PDF"
    End Sub





  • risposta
    di NICOLA (utente non iscritto) data: 16/05/2016 21:05:06

    Grazie Mister X ... funziona perfettamente !!!
    Ti chiedo un'altro favore ... se al posto di file pdf volessi stampare file .docx?



  • di Raffaele_53 data: 17/05/2016 01:01:26

    >>>io invece ho riscontrato un errore sul If , lavoro inutile
    Ps. Notato

    Rivedendo il codice scritto tempo fà, ammetto che NON ho segnalato pure un'altra cartella oltre "PDF", dovevo segnalare pure"Fatture-Stampate"

    Nel post>>>h t t p://www.excelvba.it/Forum/thread.php?f=1&t=10468
    Nessuna discrepanza nelle risposte dell'utente
    Utimo file allegato era
     
     
    Sub ARCHIVIA()
    Dim X, Rr, I, Fat, Rg As Object
    Ur = Sheets("Fatture").Range("A" & Rows.Count).End(xlUp).Row
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    I = 0
        If Application.Max(Sheets("Master").Range("C:C")) + 1 <> Sheets("Fatture").Cells(1, 1) Then
            Fat = InputBox("inserisci il numero fattura da stampare/salvare", , 0)
            If Fat = "" Or Fat = 0 Then GoTo Fine
        End If
        For X = 7 To Ur
        Fat = Sheets("Fatture").Cells(1, 1).Value
            If Sheets("Fatture").Cells(X, 2) = "DA EMETTERE" Then
                Set Rg = Sheets("Fatture").Columns("AB").Find(Sheets("Fatture").Cells(X, 1), LookIn:=xlValues, LookAt:=xlWhole)
                If Rg Is Nothing Then
                    MsgBox "nessuna corrispondenza d'azienda"
                    GoTo Fine
                Else
                    Rr = Rg.Row
                End If
                Sheets("Master").Cells(17, 8) = Fat
                Sheets("Master").Cells(17, 9) = Date
                Sheets("Master").Cells(18, 4) = Sheets("Fatture").Cells(Rr, 28)
                Sheets("Master").Cells(19, 4) = Sheets("Fatture").Cells(Rr, 30)
                Sheets("Master").Cells(20, 4) = Sheets("Fatture").Cells(Rr, 32)
                Sheets("Master").Cells(21, 5) = Sheets("Fatture").Cells(Rr, 33)
                Sheets("Master").Cells(27, 2) = Sheets("Fatture").Cells(X, 9) 'intendevo questa
                Sheets("Master").Cells(27, 9) = Sheets("Fatture").Cells(X, 11)
                Sheets("Master").Cells(31, 9) = Sheets("Fatture").Cells(X, 11)
                Sheets("Master").Cells(33, 9) = Sheets("Fatture").Cells(X, 11) + Sheets("Master").Cells(32, 9)
                Sheets("Master").Cells(38, 5) = Sheets("Fatture").Cells(Rr, 33)
                Sheets("Master").Cells(39, 6) = Sheets("Fatture").Cells(Rr, 29)
                Sheets("Master").Cells(40, 5) = Sheets("Fatture").Cells(X, 7)
                Sheets("Master").Cells(41, 5) = Sheets("Fatture").Cells(X, 5)
                Sheets("Fatture").Cells(2, 9).Copy
                Sheets("Fatture").Cells(X, 2).PasteSpecial
                Sheets("Fatture").Cells(X, 3) = Fat
                ' salvo PDF
        Dim strFile As String
        Dim PERCORSO As String
        PERCORSO = ThisWorkbook.Path & "PDF"
        Sheets("Master").Activate
        strFile = Fat & "_" & Format(Now(), "yyyy-mm-dd\_hh-mm") & ".pdf"
        'strFile = Fat & "_" & Format(Date, "yyyy-mm-dd") & ".pdf"
        Sheets("Master").ExportAsFixedFormat Type:=xlTypePDF, Filename:=PERCORSO & strFile, Quality:= _
            xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
            OpenAfterPublish:=False
                ' Stampa dovrebbe essere cosi (EDIT dovrebbe essere cosi)
                ActiveWindow.SelectedSheets.PrintOut Copies:=1
                Sheets("Master").Range("H17,I17,D18,D19:F19,D20:F20,E21:F21,B27:H28,I27:I28,I31,I33,E38,F39,E40:I40,E40:I40,E41:I41").ClearContents
                I = I + 1
           End If
        Next X
    MsgBox "fatto, " & I & " fatture salcate/stampate"
    Fine:
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    End Sub
    


  • risposta
    di NICOLA (utente non iscritto) data: 17/05/2016 11:46:45

    Attualmente i file vengono salvati in PDF ... riuscite per favore a dirmi come integrare le macro per poterli salvare anche in DOCX ?
    Grazie a tutti


  • risposta
    di NICOLA (utente non iscritto) data: 18/05/2016 12:10:28

    Scusate se rompo, ma qualcuno riesce a a dirmi come integrare le macro per poterli salvare anche in DOCX ?
    Grazie a tutti



  • di alfrimpa data: 18/05/2016 12:36:27

    Ciao Nicola

    A meno di smentite, non credo sia possibile salvare un file di Excel in Word.

    Nell'elenco in "Salva come" non c'è la voce File di Word o .doc o .docx o simili.

    Al limite si può salvare in .TXT

    Alfredo




  • risposta
    di NICOLA (utente non iscritto) data: 18/05/2016 14:21:14

    Peccato.
    Grazie ugualmente

    Ciao