저는 커뮤니티와 프로그래밍에 익숙하지 않습니다. 나는 주로 필요한 것을 성취하기 위해 무언가를 손에 넣고 사용했다. 나는 루틴을 함수 (예 : here 상세 프로세스와 유사)로 통합하여 일부 코드를 정리하려고합니다. 그러나 시작하는 방법을 잃어 버렸습니다. 지금 작성된 코드는 문서의 끝에 다른 양식을 삽입하기 위해 계속해서 반복됩니다. 내가 코드를 정리할 생각 무엇함수 또는 공용 서브 클래스 만들기
Sub InsertQA17()
If ActiveDocument.Bookmarks.Exists("\EndOfDoc") = True Then
ActiveDocument.Bookmarks("\EndOfDoc").Select
Selection.Collapse Direction:=wdCollapseEnd
Selection.Range.InsertBreak (wdSectionBreakNextPage)
Selection.PageSetup.Orientation = wdOrientPortrait
Selection.Style.ParagraphFormat.SpaceAfter = 0
Selection.Style.ParagraphFormat.SpaceBefore = 0
'OQE Form below needs to be changed to reflect the sub called
Selection.InsertFile FileName:=OQEPath & _
"\QA17.doc", Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False
UpdateThisFormsFields
Else
MsgBox "Bookmark ""\EndOfDoc"" does not exist!"
End If
End Sub
Sub InsertWELDRECORD()
If ActiveDocument.Bookmarks.Exists("\EndOfDoc") = True Then
ActiveDocument.Bookmarks("\EndOfDoc").Select
Selection.Collapse Direction:=wdCollapseEnd
Selection.Range.InsertBreak (wdSectionBreakNextPage)
Selection.PageSetup.Orientation = wdOrientLandscape
Selection.Style.ParagraphFormat.SpaceAfter = 0
Selection.Style.ParagraphFormat.SpaceBefore = 0
'OQE Form below needs to be changed to reflect the sub called
Selection.InsertFile FileName:=OQEPath & _
"\WELDRECORD.doc", Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False
UpdateThisFormsFields
Else
MsgBox "Bookmark ""\EndOfDoc"" does not exist!"
End If
End Sub
는 1. 리본 버튼을 누르면 때 전달 변수를 수신 코드의 고기를 수납하는 기능입니다. 2. 변수 끝에 따라 문서의 끝에 삽입을 수행하는 함수 호출.
내가보기에 문제 : 1. 나는 약 50 가지 형식 (무차별 방식)으로 반복해서 코드를 반복했다. 2. 일부 문서는 세로 및 가로 방향입니다. (저는 이것이 변수 일 수 있다고 가정합니다.) 3. Function (내가 여러 번 링크를 읽었습니다.)의 개념을 이해하는 동안, 어떻게 시작해야할지 모르겠습니다. 나는 그것이 쉬워야한다는 것을 안다.
다시 한 번 배우고 있습니다. 친절하시기 바랍니다. 나를 올바른 방향으로 보내야한다면.
는 랜디
대단히 감사합니다. 지금 코드를 소화하고 있습니다. 완전히 이해하고 무언가를 배웁니다. – RandyB
.paragraphs.spacebefore와 .spaceafter는 들어오는 파일에 영향을주지 않는 이유는 무엇입니까? 내 방법은 들어오는 파일에서 단락 서식을 제거했습니다. 이것은 선택에서 범위로 변경된 결과입니까? 그렇다면이 능력을 유지할 수있는 방법이 있습니까? – RandyB