Solved

Error in excel when opening a workbook

Posted on 2011-09-27
11
305 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will show you how to use shortcut menus in the Access run-time environment.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
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…

911 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

22 Experts available now in Live!

Get 1:1 Help Now