- Option Explicit
-
- Sub MDMain()
- Dim Page As Integer
- Dim StartRange As Range
- Dim Chemin As String
-
- Chemin = ActiveDocument.Path + "\"
- Selection.HomeKey Unit:=wdStory
- Set StartRange = Selection.Range
- Selection.Collapse
- While StartRange.End <= Selection.End And ActiveDocument.Content.End > Selection.End
- Page = Page + 1
- Selection.HomeKey Unit:=wdStory
- Selection.Extend
- Application.Browser.Next
- On Error GoTo SelectionFin
- Selection.Cut
- GoTo Suivant
- SelectionFin:
- Selection.EndKey Unit:=wdStory
- Selection.Cut
- Suivant:
- On Error GoTo 0
- Documents.Add Template:="", NewTemplate:=False, DocumentType:=1
- Selection.Paste
- ActiveDocument.SaveAs FileName:=Chemin + "Page" + CStr(Page) + ".html", fileformat:=wdFormatHTML
- ActiveDocument.Close savechanges:=False
- Wend
- End Sub
Option Explicit
Sub MDMain()
Dim Page As Integer
Dim StartRange As Range
Dim Chemin As String
Chemin = ActiveDocument.Path + "\"
Selection.HomeKey Unit:=wdStory
Set StartRange = Selection.Range
Selection.Collapse
While StartRange.End <= Selection.End And ActiveDocument.Content.End > Selection.End
Page = Page + 1
Selection.HomeKey Unit:=wdStory
Selection.Extend
Application.Browser.Next
On Error GoTo SelectionFin
Selection.Cut
GoTo Suivant
SelectionFin:
Selection.EndKey Unit:=wdStory
Selection.Cut
Suivant:
On Error GoTo 0
Documents.Add Template:="", NewTemplate:=False, DocumentType:=1
Selection.Paste
ActiveDocument.SaveAs FileName:=Chemin + "Page" + CStr(Page) + ".html", fileformat:=wdFormatHTML
ActiveDocument.Close savechanges:=False
Wend
End Sub