Quote:
Originally Posted by 4mysanity
The first part of the code (the first sub routine) is supposed to split out each paragraph number. The second part of the code (the part you did) - is supposed to insert the images to the pdfs that are going to be created.
Since there are two macro's in two different sub's would it be better if they were combined as one macro?
|
Frankly, I'm not sure what your 'Splitter' macro is supposed to achieve that that second macro doesn't already do. The document you've provided has no Section breaks, so there is only ever one Section to process and all that would happen, if anything, is that the document as a whole would be saved as a PDF. That said, the 'Splitter' code could be made much more efficient:
Code:
Sub Splitter()
Dim numlets As Long, Counter As Long, sPath As String, DocName As String
numlets = ActiveDocument.Sections.Count
If numlets > 1 Then numlets = numlets - 1
sPath = "k:\test\images\"
For Counter = 1 To numlets
DocName = sPath & Format(Counter, "000")
ActiveDocument.Sections.First.Range.Cut
Documents.Add
With ActiveDocument.Range
.Paste
.Characters.First = vbNullString
.SaveAs2 FileName:=DocName, FileFormat:=wdFormatPDF
.Close
End With
Next Counter
End Sub