Onderstaande code leest de secties van een word-document en schijft in een word-document welke sectie op welke pagina begint.
Nu wil ik graag dat alle word-documenten in een directory worden ingelezen en bovenstaande uitkomst in een text-bestand wordt gezet.
Dim strPageSection As String
Selection.HomeKey Unit:=wdStory
strPageSection = "Page 1 - Section 1" & vbCrLf
Do Until Selection.Information(wdActiveEndPageNumber) = Selection.Information(wdNumberOfPagesInDocument)
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1, Name:=""
strPageSection = strPageSection & "Page " & Selection.Information(wdActiveEndPageNumber) & " - Section " & Selection.Information(wdActiveEndSectionNumber) & vbCrLf
Loop
Documents.Add DocumentType:=wdNewBlankDocument
Selection.TypeText Text:=strPageSection
Nu wil ik graag dat alle word-documenten in een directory worden ingelezen en bovenstaande uitkomst in een text-bestand wordt gezet.
Dim strPageSection As String
Selection.HomeKey Unit:=wdStory
strPageSection = "Page 1 - Section 1" & vbCrLf
Do Until Selection.Information(wdActiveEndPageNumber) = Selection.Information(wdNumberOfPagesInDocument)
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1, Name:=""
strPageSection = strPageSection & "Page " & Selection.Information(wdActiveEndPageNumber) & " - Section " & Selection.Information(wdActiveEndSectionNumber) & vbCrLf
Loop
Documents.Add DocumentType:=wdNewBlankDocument
Selection.TypeText Text:=strPageSection