[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Run-time error opening an excel workbook

Posted on 2011-10-25
3
Medium Priority
?
1,913 Views
Last Modified: 2012-05-12
When I open a particular Excel workbook it gives me a
run-time error '-2147024809 (80070057)':
Requested shapes are locked for selection.
then when i click debug it take me to the following line of code in the sub that I have attached below.

 ActiveSheet.Shapes("Text Box 3").Select




Sub Auto_Open()

    Dim Summary_Text As String
    Dim Temp As String
    Dim count_text As Integer
    
    Worksheets("Summary").Select
    Summary_Text = Range("Summary!A102")
    Temp = Left(Summary_Text, 200)
        
    ActiveSheet.Shapes("Text Box 3").Select
    Selection.Characters.Text = Temp
    count_text = 201
    Do
        Summary_Text = Mid(Summary_Text, 201)
        Temp = Left(Summary_Text, 200)
        
        Selection.Characters(count_text).Insert String:=Temp
        
        If Len(Summary_Text) < 200 Then Exit Do
        count_text = count_text + 200
    Loop

    Worksheets("Summary").Select
    Range("A1").Select
    Worksheets("Report Information").Select
    Range("A1").Select
End Sub

Open in new window

0
Comment
Question by:jlcannon
  • 2
3 Comments
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 2000 total points
ID: 37027225
Hello,

looks like the sheet might be protected. Use code to unprotect it before selecting anything.

    ActiveSheet.Unprotect

cheers, teylyn

0
 
LVL 50
ID: 37027251
If the sheet has a password, you can use this

' after the dim statements
    ActiveSheet.Unprotect Password:="secret"

' rest of your code


' before selecting the next sheet
    ActiveSheet.Protect  Contents:=True, Password:="secret"

Open in new window


cheers, teylyn

0
 

Author Closing Comment

by:jlcannon
ID: 37027288
perfection A+
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question