-2
指定された図形名とその内部のテキストを含むテキストファイルを出力する必要があります。図形からテキストを読み取るときに値が範囲外です。
私は取得していますエラーは、指定された値が範囲外である
実行時エラー「-2147024809(80070057)」です。私のPCで
Sub test()
Dim objFSO As Object, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Users\[user]\Documents\text.txt", 2)
objFile.Write "" 'This clears the text file
Dim obj As Shape
For Each obj In ActiveSheet.Shapes
sWrite = obj.Name & "; Content: " & obj.TextFrame2.TextRange.Characters.text
Debug.Print sWrite
objFile.WriteLine sWrite
Next obj
objFile.Close
End Sub
あなたは*添字*範囲外であることを意味するのですか? – Comintern
正確なエラーとはどのような行ですか? –
'sWrite = obj.Name & ";内容:"&obj.TextFrame2.TextRange.Characters(0、300) 'この行はあなたの問題ですか?300文字を持たない場合は、範囲外の添字を取得しますエラー。 – Kyle