述べたように、VBA (Visual Basic for Applications) で指定されたインデックスで文字列から文字を取得する方法は? 私はGoogleを検索しましたが、これらは機能しません:
s(index)
、
s.Chars(index)
、s,Characters(index)
では、指定されたインデックスで char を取得する方法は?
このs
方法で行うことができるよりも文字列である場合:
Mid(s, index, 1)
質問の下のコメントに基づいて編集します。
少し異なるアプローチが必要なようです。この方法で試してください:
Dim character As String 'Integer if for numbers
's = ActiveDocument.Content.Text - we don't need it
character = Activedocument.Characters(index)
指定されたインデックスの文字列から 1 文字を取得する
Dim pos As Integer
Dim outStr As String
pos = 2
Dim outStr As String
outStr = Left(Mid("abcdef", pos), 1)
outStr="b"