[英]run time error -2147024809 (80070057) the specified value is out of range with shape
Here is my code, 这是我的代码,
If ActiveWorkbook.Sheets("About tool").Range("G1").Value = 1 Then
ActiveWorkbook.Sheets("About tool").Range("G1").Value = 0
With ActiveWorkbook.Sheets("About tool").Shapes("Rounded Rectangle 2").TextFrame2
If .HasText Then
.TextRange.Delete
.TextRange.Text = "Unlock All"
End If
End With
ElseIf ActiveWorkbook.Sheets("About tool").Range("G1").Value = 0 Then
ActiveWorkbook.Sheets("About this tool ").Range("G1").Value = 1
With ActiveWorkbook.Sheets("About tool").Shapes("Rounded Rectangle 2").TextFrame2
If .HasText Then
.TextRange.Delete
.TextRange.Text = "Lock All"
End If
End With
End If
Here on the ELSEIF section, I am getting an error saying "runtime error -2147024809 (80070057) the specified value is out of range". 在ELSEIF部分,我收到一条错误消息:“运行时错误-2147024809(80070057)指定的值超出范围”。
It is working fine in the IF section. 在IF部分工作正常。 it is the same code with just change in the string passed as text.
它是相同的代码,只是更改了作为文本传递的字符串。
Sry, for wasting your time to click on this question. 对不起,浪费您的时间来单击此问题。
It's just that, I was trying to edit the text of the shape when the sheet was protected. 就是这样,当工作表受保护时,我试图编辑形状的文本。 which is the cause for the error.
这是导致错误的原因。
Should have read through the below link earlier. 应该早点阅读以下链接。
Microsoft Excel VBA - Run-Time Error '-2147024809 (80070057)' Microsoft Excel VBA-运行时错误'-2147024809(80070057)'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.