사용자 정의 문서 속성은 문서와 관련된 고유 정보를 저장하는 좋은 방법입니다. 예를 들어 문서와 함께 저장해야하는 회사 지정 문서 번호가있을 수 있습니다. 사용자 지정 속성은이 목적을 위해 청구서에 아주 잘 맞습니다.

문서에 사용자 정의 속성을 추가 할 때 한 문서에서 다른 문서로 쉽게 복사 할 수있는 방법이 있는지 궁금해 할 수 있습니다.

안타깝게도 이렇게 할 수있는 방법이 없습니다. (내 예상으로는이 기능이 오거나이저에 미세한 추가 기능을 제공 할 것입니다.) 그러나 복사 작업을 수행 할 매크로를 만들 수 있습니다. 다음 매크로는이를 수행합니다.

Sub CopyDocProps()

Dim dp() As DocumentProperty     Dim CustomPropCount As Integer     Dim i As Integer     Dim intResponse As Integer

If Windows.Count > 2 Then         MsgBox "There are more than two windows. Please " & _           "close the others and re-run the macro.", , _           "Too many windows"

Exit Sub     End If

On Error GoTo Err_Handler

intResponse = MsgBox("Are you currently in the source document?", _       vbYesNoCancel, "Copy Custom Properties")



If intResponse = vbNo Then Application.Run MacroName:="NextWindow"



CustomPropCount = ActiveDocument.CustomDocumentProperties.Count     ReDim dp(1 To CustomPropCount)



For i = 1 To CustomPropCount         Set dp(i) = ActiveDocument.CustomDocumentProperties(i)

Next i

Application.Run MacroName:="NextWindow"



For i = 1 To CustomPropCount         If dp(i).LinkToContent = True Then             ActiveDocument.CustomDocumentProperties.Add _               Name:=dp(i).Name, _               LinkToContent:=True, _               Value:=dp(i).Value, _               Type:=dp(i).Type, _               LinkSource:=dp(i).LinkSource         Else             ActiveDocument.CustomDocumentProperties.Add _               Name:=dp(i).Name, _               LinkToContent:=False, _               Value:=dp(i).Value, _               Type:=dp(i).Type         End If     Next i

MsgBox "The properties have been copied."

Exit Sub

Err_Handler:

' if Word raises an error, then allow the user     ' to update the custom document property          intResponse = MsgBox("The custom document property (" & _       dp(i).Name & ") already exists." & vbCrLf & vbCrLf & _       "Do you want to update the value?", vbYesNoCancel, _       "Copy Custom Properties")



Select Case Response         Case vbCancel             End         Case vbYes             ActiveDocument.CustomDocumentProperties(dp(i).Name).Value _               = dp(i).Value             Resume Next         Case vbNo             Resume Next     End Select End Sub

이 코드는 사용자 지정 속성을 복사하는 방법의 예이지만 방탄이 아닙니다. 예를 들어 소스 문서에 실제로 사용자 정의 속성이 있는지 확인하지 않습니다. 단지 있다고 가정합니다. 그러나 이러한 코딩은 쉽게 추가 할 수 있습니다.

매크로를 사용하려면 소스 및 대상 문서 만 열려 있는지 확인하고 문서 당 하나의 창만 열어야합니다. 매크로가 완료되면 대상 문서를 저장해야합니다.

_ 참고 : _

이 페이지 (또는 WordTips 사이트의 다른 페이지)에 설명 된 매크로를 사용하는 방법을 알고 싶다면 유용한 정보가 포함 된 특별 페이지를 준비했습니다.

link : / wordribbon-WordTipsMacros [새 브라우저 탭에서 특별 페이지를 열려면 여기를 클릭하세요].

_WordTips_는 비용 효율적인 Microsoft Word 교육을위한 소스입니다.

(Microsoft Word는 세계에서 가장 널리 사용되는 워드 프로세싱 소프트웨어입니다.)이 팁 (1340)은 Microsoft Word 97, 2000, 2002 및 2003에 적용됩니다. Word의 리본 인터페이스에 대한이 팁 버전 (Word 2007)을 찾을 수 있습니다. 이후) 여기 :

link : / wordribbon-Copying_Custom_Properties [사용자 지정 속성 복사].