Solved

Error in excel when opening a workbook

Posted on 2011-09-27
11
312 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
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

623 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