PC Review


Reply
Thread Tools Rate Thread

Code OK in XL2003 but Run-time error '1004' in xl2007

 
 
Ken Johnson
Guest
Posts: n/a
 
      22nd Jul 2009
I have a Text Box on Sheet2 assigned to the following macro...

Public Sub CheckTextFit()
Dim K As Long, StrText As String
With Worksheets("Sheet2").Shapes(Application.Caller)
.TextFrame.Characters.Text = ""
StrText = ActiveCell.Value
Do
.TextFrame.Characters(Start:=K * 255 + 1,
Length:=255).Text _
= Mid(StrText, K * 255 + 1, 255)
K = K + 1
Loop While K * 255 < Len(StrText)
End With
End Sub

When I click the text box, in XL2003, the code transfers the contents
of the active cell into the text box in lots of 255 characters . In
XL2007 I get Run-time error '1004' Application-defined or object-
defined error, and this line is highlight...

.TextFrame.Characters(Start:=K * 255 + 1, Length:=255).Text _
= Mid(StrText, K * 255 + 1, 255)

There is no worksheet or workbook protection.

Any ideas?

Ken Johnson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation error (XL2003 and XL2007) ker_01 Microsoft Excel Crashes 1 18th Feb 2010 04:46 PM
XL2007 and XL2003 LeeCC Microsoft Excel Misc 2 18th Dec 2008 04:44 PM
Opening XLS with XL2003, not XL2007 jg70124@gmail.com Microsoft Excel Discussion 2 21st Sep 2007 01:34 AM
XL2007 vs XL2003 =?Utf-8?B?QXJ0?= Microsoft Excel Programming 13 21st Apr 2007 04:32 PM
Code Run-time error '1004' pjhageman Microsoft Excel Programming 3 11th Jan 2004 12:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:17 AM.