0
우편물이 문서정규식은 구분 단어
Sub BreakOnSection()
' Used to set criteria for moving through the document by section.
Application.Browser.Target = wdBrowseSection
'A mail merge document ends with a section break next page.
'Subtracting one from the section count stop error message.
For i = 1 To ((ActiveDocument.Sections.Count) - 1)
'Note: If a document does not end with a section break,
'substitute the following line of code for the one above:
'For I = 1 To ActiveDocument.Sections.Count
'Select and copy the section text to the clipboard.
ActiveDocument.Bookmarks("\Section").Range.Copy
'Create a new document to paste text from clipboard.
Documents.Add ("C:\Users\simaco\Desktop\New folder (4)\new.dotx")
Selection.Paste
' Removes the break that is copied at the end of the section, if any.
Selection.MoveUp unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Delete unit:=wdCharacter, Count:=1
ChangeFileOpenDirectory "C:\Users\simaco\Desktop\New folder (4)"
DocNum = DocNum + 1
With ActiveDocument
Set r = .GoTo(wdGoToPage, wdGoToLast)
Set r = .Range(r.Start - 1, .Characters.Count)
r.Delete
End With
ActiveDocument.SaveAs FileName:="test_" & DocNum & ".doc"
ActiveDocument.Close
' Move the selection to the next section in the document.
Application.Browser.Next
Next i
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
생성에서 내가있는 John Doe
이름으로 각 페이지를 저장할 개별 문서에서 각 섹션을 저장하려면이 코드를 사용하여 일치 둘 사이의 이름을 사용하는 이 같은 두 개의 구분 단어 사이에 문서에서 발견 :
Employee John Doe that etc etc.
가 어떻게이 등록을 사용하여 두 단어 사이 ActiveDocument
(Employee
및 that
)에 John Doe
을 일치시킬 수 있습니다 ular 식을 사용하고 발견 된 문자열을 ActiveDocument.SaveAs FileName:="Doc" & FoundString & ".doc"
과 같이 사용할 수 있습니까?
홍길동 반 어떤 이름 –
당신이 자바 스크립트/JScript의 맛에 정규식을 변경할 수 –
위의 내 대답을 업데이트? –