-3

i have a document with several images.

Under every image i have added via VBA a caption like "Fig.XX " Under this caption i have a phrase which should be the caption description of this image.

My question is now how do i get the text under the caption into the Placeholder? enter image description here

macropod
  • 12,757
  • 2
  • 9
  • 21
Andreas
  • 9
  • 3
  • 2
    Please take time to read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and then [edit](https://stackoverflow.com/posts/66901374/edit) your question accordingly. Adding a screenshot of the document might help in understanding what you are trying to describe. – Timothy Rylatt Apr 01 '21 at 10:09
  • 1
    Posting your code will also help. We need to se what you have already tried. – Timothy Rylatt Apr 01 '21 at 12:05

1 Answers1

1

For example:

Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "<<Placeholder>>^p"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .Style = wdStyleCaption
  End With
  Do While .Find.Execute
    .Text = vbNullString
    .Style = wdStyleCaption
    .Collapse wdCollapseEnd
  Loop
End With
Application.ScreenUpdating = True
End Sub
macropod
  • 12,757
  • 2
  • 9
  • 21