2

文字列をブックマークに送信するために使用する変数 (strLastname) があります。それはうまくいきます。また、その変数を使用して、長いドキュメントの一時的なテキスト「Name>」を置き換えたいと考えています。

これは私が今持っているものです。

  Sub cmdOK_Click()
    Dim strLastname As String   ' from dialogue box "BoxLastname" field
    strLastname = BoxLastname.Value
....
  End sub

動作しないマクロ:

Sub ClientName()

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
    .Text = "Name>"
    .Replacement.Text = strLastname??????

             'Selection.TypeText (strLastname) ????
              'How to use the variable from the Dialogue Box - strLastname????

     End With
  Selection.Find.Execute Replace:=wdReplaceAll
End Sub

私は試した 。Replacement.Text = strLastname and .Replacement.Text = BoxLastname.Value しかし誰も働かない。

4

1 に答える 1