IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

Sauvegarde non effectuée [XL-2007]


Sujet :

Macros et VBA Excel

  1. #21
    Membre éclairé Avatar de grisan29
    Homme Profil pro
    ouvrier poseur
    Inscrit en
    Octobre 2006
    Messages
    866
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ouvrier poseur
    Secteur : Bâtiment

    Informations forums :
    Inscription : Octobre 2006
    Messages : 866
    Par défaut
    bonjour Mercatog

    je te joints le fichier que je viens d'épurer

    Pascal

  2. #22
    Expert éminent Avatar de mercatog
    Homme Profil pro
    Inscrit en
    Juillet 2008
    Messages
    9 435
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations forums :
    Inscription : Juillet 2008
    Messages : 9 435
    Par défaut
    J'ai testé le code suivant avec succès

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    Private Sub NouvelleFeuille_Click()
    Dim Nom As String, Chemin As String
    Dim shNew As Worksheet
     
    Application.ScreenUpdating = False
    Chemin = "C:\Save_Devis_ExcelGStock\Devis"
     
    If Dir(Chemin, vbDirectory) <> "" Then
        With ThisWorkbook.Worksheets("Facturation")
            Set shNew = Sheets.Add
            .UsedRange.Copy
            With shNew.Range("A1")
                .PasteSpecial xlPasteValues
                .PasteSpecial xlPasteFormats
            End With
            Application.CutCopyMode = False
     
            shNew.Move
            Set shNew = Nothing
            Nom = .Range("D17").Value & "-" & .Range("J5").Value & ".xls"
            Application.DisplayAlerts = False
            ActiveWorkbook.SaveAs Filename:=Chemin & "\" & Nom, FileFormat:=xlExcel8
            ActiveWorkbook.Close
            Application.DisplayAlerts = True
     
            .Range("J5:J8", "C16").ClearContents
            If .[MTTC].Row - 9 > 19 Then
                .Range("C19:C" & .[MTTC].Row - 9).EntireRow.Delete
            ElseIf .[MTTC].Row - 9 = 19 Then
                .Rows(19).Clear
            End If
     
            Select Case UCase(.Range("D1"))
                Case Is = "FACTURE"
                    .Range("S7") = .Range("S7") + 1
                Case Is = "DEVIS"
                    .Range("S8") = .Range("S8") + 1
            End Select
        End With
        MsgBox "Archivage terminé avec succès de " & Nom
    Else
        MsgBox "Chemin " & Chemin & " inéxistant"
    End If
    End Sub

  3. #23
    Membre éclairé Avatar de grisan29
    Homme Profil pro
    ouvrier poseur
    Inscrit en
    Octobre 2006
    Messages
    866
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ouvrier poseur
    Secteur : Bâtiment

    Informations forums :
    Inscription : Octobre 2006
    Messages : 866
    Par défaut
    bonjour Mercatog

    aujourdhui j'ai apportet mon portable pour essyer car celui ci a de retour son problème d'automation
    donc ca bug a
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ActiveWorkbook.SaveAs Filename:=Chemin & "\" & Nom, FileFormat:=xlExcel8
    toujours pour les meme raisons et je n'ai absolument rien changé a ton code
    nouveau message avant celui d'erreur automation

    erreur système & H80004005 (-2147467259)
    Pascal

  4. #24
    Membre éclairé Avatar de grisan29
    Homme Profil pro
    ouvrier poseur
    Inscrit en
    Octobre 2006
    Messages
    866
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ouvrier poseur
    Secteur : Bâtiment

    Informations forums :
    Inscription : Octobre 2006
    Messages : 866
    Par défaut
    bonjour Mercatog
    voic le code qui fonctionne mais m'efface 3 lignes de trop dans le bas de feuilles entre les données et le bas de page
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    Private Sub NouvelleFeuille_Click()
    Dim Nom As String, Chemin As String
    Dim shNew As Worksheet
     
    Application.ScreenUpdating = False
    Chemin = "C:\Save_Devis_ExcelGStock\Devis"
     
    If Dir(Chemin, vbDirectory) <> "" Then
        With ThisWorkbook.Worksheets("Facturation")
            Set shNew = Sheets.Add
            .UsedRange.Copy
            With shNew.Range("A1")
                .PasteSpecial xlPasteValues
                .PasteSpecial xlPasteFormats
            End With
            Application.CutCopyMode = False
     
            shNew.Move
            Set shNew = Nothing
            Nom = .Range("D17").Value & "-" & .Range("J5").Value & ".xls"
            Application.DisplayAlerts = False
            ActiveWorkbook.SaveAs Filename:=Chemin & "\" & Nom, FileFormat:=xlExcel8
            ActiveWorkbook.Close
            Application.DisplayAlerts = True
     
            .Range("J5:J8", "C16").ClearContents
            If .[MTTC].Row - 9 > 19 Then
                .Range("C19:C" & .[MTTC].Row - 9).EntireRow.Delete
            ElseIf .[MTTC].Row - 9 = 19 Then
                .Rows(19).Clear
            End If
     
            Select Case UCase(.Range("D1"))
                Case Is = "FACTURE"
                    .Range("S7") = .Range("S7") + 1
                Case Is = "DEVIS"
                    .Range("S8") = .Range("S8") + 1
            End Select
        End With
        MsgBox "Archivage terminé avec succès de " & Nom
    Else
        MsgBox "Chemin " & Chemin & " inéxistant"
    End If
    End Sub

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. PostgresSQL Sauvegarde non effectuée
    Par Invité dans le forum Hibernate
    Réponses: 1
    Dernier message: 20/02/2008, 16h52
  2. Me.Controls.add sauvegarde non effectuée
    Par XineMA dans le forum Macros et VBA Excel
    Réponses: 9
    Dernier message: 31/08/2007, 11h21
  3. Ecriture sur fichier texte non effectuée
    Par lodan dans le forum Langage
    Réponses: 4
    Dernier message: 20/02/2007, 10h20
  4. Update non effectué
    Par nellynew dans le forum Access
    Réponses: 1
    Dernier message: 13/09/2006, 13h37
  5. [Upload] Upload de wav et renommage non effectué
    Par PuppeT mAsTer dans le forum Langage
    Réponses: 4
    Dernier message: 17/07/2006, 19h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo