Solved

Error in excel when opening a workbook

Posted on 2011-09-27
11
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 19

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
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…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

710 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