Jay는 문서의 텍스트 상자에 문서 속성 필드가 삽입 된 상황이 있습니다. Ctrl + A를 누른 다음 F9를 누르면 문서의 모든 속성 문서 필드가 업데이트되지만이 필드는 Jay의 작업에 의해 업데이트되지 않습니다. 머리글 및 바닥 글의 필드를 업데이트하는 프로세스는 텍스트 상자 내부의 필드도 업데이트하지 않습니다.

Jay는 키보드를 사용하여 수동으로 필드를 업데이트 할 수있는 방법이 있는지 또는 매크로를 사용하여 업데이트 할 수있는 방법이 있는지 궁금합니다.

필드는 많은 문서 요소에 배치 될 수 있습니다. 예를 들어 주 문서 텍스트, 텍스트 상자, 머리글 또는 바닥 글, 도형 또는 특수 표에있을 수 있습니다. Ctrl + A를 누르면 모든 문서가 선택되지만 F9 키를 누르면 모든 문서 요소의 필드가 업데이트되지 않습니다. 대신 매크로를 사용하여 업데이트해야합니다.

단순히 매크로가 텍스트 상자의 필드를 업데이트하도록하려면이 작업을 수행하면됩니다. 다음 매크로는 문서의 각 도형을 단계별로 실행합니다 (텍스트 상자와 도형 포함)

도형에 텍스트가 포함 된 경우 포함 된 모든 필드를 업데이트합니다.

Sub UpdateTBFields()

Dim shp As Shape

For Each shp In ActiveDocument.Shapes         With shp.TextFrame             If .HasText Then                 .TextRange.Fields.Update             End If         End With     Next End Sub

이 매크로는 키보드 단축키에 할당되어 단축키를 터치하여 필드를 쉽게 업데이트 할 수 있습니다. 물론 모든 필드가 어디에 있든 업데이트하는보다 포괄적 인 매크로를 개발할 수 있습니다. (기억하십시오. 필드는 여러 문서 요소에 포함될 수 있습니다.)이 경우 다음과 같은보다 포괄적 인 매크로 버전을 고려하십시오.

Public Sub UpdateAllFields()

Dim doc As Document     Dim wnd As Window     Dim lngMain As Long     Dim lngSplit As Long     Dim lngActPane As Long     Dim rngStory As Range     Dim TOC As TableOfContents     Dim TOA As TableOfAuthorities     Dim TOF As TableOfFigures     Dim shp As Shape

' Set Objects     Set doc = ActiveDocument     Set wnd = ActiveDocument.ActiveWindow

' get Active Pane Number     lngActPane = wnd.ActivePane.Index

' Hold View Type of Main pane     lngMain = wnd.Panes(1).View.Type

' Hold SplitSpecial     lngSplit = wnd.View.SplitSpecial

' Get Rid of any split     wnd.View.SplitSpecial = wdPaneNone

' Set View to Normal     wnd.View.Type = wdNormalView

' Loop through each story in doc to update     For Each rngStory In doc.StoryRanges         If rngStory.StoryType = wdCommentsStory Then             Application.DisplayAlerts = wdAlertsNone             ' Update fields             rngStory.Fields.Update             Application.DisplayAlerts = wdAlertsAll         Else             ' Update fields             rngStory.Fields.Update         End If     Next

'Loop through text boxes and update     For Each shp In doc.Shapes         With shp.TextFrame             If .HasText Then                 shp.TextFrame.TextRange.Fields.Update             End If         End With     Next

' Loop through TOC and update     For Each TOC In doc.TablesOfContents         TOC.Update     Next

' Loop through TOA and update     For Each TOA In doc.TablesOfAuthorities         TOA.Update     Next

' Loop through TOF and update     For Each TOF In doc.TablesOfFigures         TOF.Update     Next

' Return Split to original state     wnd.View.SplitSpecial = lngSplit

' Return main pane to original state     wnd.Panes(1).View.Type = lngMain

' Active proper pane     wnd.Panes(lngActPane).Activate

' Close and release all pointers     Set wnd = Nothing     Set doc = Nothing End Sub

_ 참고 : _

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

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

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

(Microsoft Word는 세계에서 가장 널리 사용되는 워드 프로세싱 소프트웨어입니다.)이 팁 (12344)은 Microsoft Word 2007, 2010, 2013, 2016, 2019 및 Office 365의 Word에 적용됩니다.이 팁의 버전은 다음과 같습니다. Word의 이전 메뉴 인터페이스 :

link : / word-Updating_a_Field_in_a_Text_Box [텍스트 상자의 필드 업데이트].