Solved

Error in excel when opening a workbook

Posted on 2011-09-27
11
309 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
ID: 36712887
No attachment
0
 

Author Comment

by:jlcannon
ID: 36712958
0
 
LVL 26

Expert Comment

by:redmondb
ID: 36713091
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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 18

Expert Comment

by:Richard Daneke
ID: 36713092
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
ID: 36713714
@redmondb, that still gives me the same error.

@DodahD, but even when there is data in box 3 it gives the error.
0
 

Author Comment

by:jlcannon
ID: 36713743
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
ID: 36713747
jlcannon,

Please try the attached.

Regards,
Brian.

ESRA-Blank-Report-V2.xls
0
 

Author Closing Comment

by:jlcannon
ID: 36713810
Thank you. solution worked perfect.
0
 
LVL 26

Expert Comment

by:redmondb
ID: 36713828
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
ID: 36716333
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
ID: 36716467
Glad to help!

Cheers,
Brian.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
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…

821 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