Comment Scinder Un Classeur En Fichiers html

jeromechantilly Messages postés 5 Statut Membre -  
cs_Le Pivert Messages postés 8437 Statut Contributeur -
Bonjour,

Bonjour,

Je souhaite enregistré les onglet dans chaqun un fichier mais dans un format html

j'ai trouve qui me scinde le fichier:

Sub Splitbook()
'Updateby20140612
Dim xPath As String
xPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In ThisWorkbook.Sheets
xWs.Copy
Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

mais je n'arrive pas a faire la meme chose en mettant le format html

2 réponses

  1. cs_Le Pivert Messages postés 8437 Statut Contributeur 730
     
    Bonjour,

    comme ceci:

    Option Explicit
    Sub Splitbook()
    Dim o As Worksheet 'déclare la variable o (Onglet)
    Dim no As String 'déclare la variable no (Nom de l'Onglet)
    Dim chem As String 'déclare la variable chem (CHEMin)
     
    chem = ThisWorkbook.Path & "\" 'définit la variable chem
    For Each o In Sheets 'boucle sur tous les onglets du classeur
        no = o.Name 'définit la variable no
        o.Copy 'copy l'onglet
        'crée un nouveau classeur ayant pour nom de nom de l'onglet dans le même dossier
         ActiveWorkbook.SaveAs Filename:=chem & no & ".txt", _
            FileFormat:=xlText, CreateBackup:=False
        Next o 'prochain onglet de la boucle
    End Sub
    


    1
  2. jeromechantilly Messages postés 5 Statut Membre
     
    ou si je peux avoir en format .txt
    merci d'avance
    0