Hirdetés

2024. május 8., szerda

Gyorskeresés

Hozzászólások

(#2596) bela85 válasza bela85 (#2595) üzenetére


bela85
aktív tag

Kísérletezem közbe másik makróval is.. de sajnos ennél is olyan problémába ütközöm, hogy szétszedi a formázást, és indokolatlanul nagy térközöket, sortávolságokat tesz be ami alapján az alap doksi ami 3 oldalas elcsúszik 4 oldalasra.

Sub DocumentSplitter()
' Split a large document into multi-page blocks
Dim iSplit As Long, iCount As Long, iLast As Long
Dim RngSplit As Range, StrDocName As String, StrDocExt As String
With ActiveDocument
  iSplit = InputBox("The document contains " & .ComputeStatistics(wdStatisticPages) & " pages." _
    & vbCr & "What is the page block count for splitting?", "Document Splitter")
  StrDocName = .FullName
  StrDocExt = "." & Split(StrDocName, ".")(UBound(Split(StrDocName, ".")))
  StrDocName = Left(StrDocName, Len(StrDocName) - Len(StrDocExt)) & "_"
  For iCount = 0 To Int(.ComputeStatistics(wdStatisticPages) / iSplit)
    If .ComputeStatistics(wdStatisticPages) > iSplit Then
      iLast = iSplit
    Else
      iLast = .ComputeStatistics(wdStatisticPages)
    End If
    Set RngSplit = .GoTo(What:=wdGoToPage, Name:=iLast)
    Set RngSplit = RngSplit.GoTo(What:=wdGoToBookmark, Name:="\page")
    RngSplit.Start = .Range.Start
    RngSplit.Cut
    Documents.Add
    Selection.Paste
    ActiveDocument.SaveAs FileName:=StrDocName & iCount + 1 & StrDocExt, AddToRecentFiles:=False
    ActiveWindow.Close
  Next iCount
  Set RngSplit = Nothing
  '.Close Savechanges:=False
End With
End Sub

Copyright © 2000-2024 PROHARDVER Informatikai Kft.