Solved

Error in excel when opening a workbook

Posted on 2011-09-27
11
303 Views
Last Modified: 2012-05-12
I keep getting an error when opening an excel workbook. it says "Run-Time error '1004': Unable to get the Characters property of the TextBox class." and when i click debug it take me to the line "Selection.Characters(count_text).Insert String:=Temp" I have attached a copy of the spreadsheet.
0
Comment
Question by:jlcannon
11 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
Comment Utility
No attachment
0
 

Author Comment

by:jlcannon
Comment Utility
0
 
LVL 26

Expert Comment

by:redmondb
Comment Utility
Hi, jlcannon.

The problem is that the "count_text" is greater than the number of existing characters. You might try the following line instead...

Selection.Characters(IIf(Selection.Characters.Count < count_text, Selection.Characters.Count, count_text)).Insert String:=Temp

Regards,
Brian.
0
 
LVL 18

Expert Comment

by:Richard Daneke
Comment Utility
You have exceeded your limit in characters in the Auto Open macro.

The macro code is copied in this response. count_text is 201 and the Do starts with a text box of 200 max.  But the Text Box 3 has NULL character count.  The text box has no characters.
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
 

Author Comment

by:jlcannon
Comment Utility
@redmondb, that still gives me the same error.

@DodahD, but even when there is data in box 3 it gives the error.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:jlcannon
Comment Utility
Sorry, I just dont understnd it. I inherited this workbook from the person that previously held this job and since the migration from XP on the workstations to windows 7 this has been happening. IS there a way for me to fix this.
0
 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
Comment Utility
jlcannon,

Please try the attached.

Regards,
Brian.

ESRA-Blank-Report-V2.xls
0
 

Author Closing Comment

by:jlcannon
Comment Utility
Thank you. solution worked perfect.
0
 
LVL 26

Expert Comment

by:redmondb
Comment Utility
jlcannon,

Thanks kindly!

(Possible issue you had earlier is that I neglected to mention that the line needed to be changed in two macros - Auto_Open and Auto_Close - apologies.)

Regards,
Brian.
0
 

Author Comment

by:jlcannon
Comment Utility
yes, I finally noticed that since the workbook i copied up here i had to whitewash when i put the auto_open sub in I could open the workbook without incident but got the error when closing it. Thank you so much for the help.
0
 
LVL 26

Expert Comment

by:redmondb
Comment Utility
Glad to help!

Cheers,
Brian.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now