Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Code OK in XL2003 but Run-time error '1004' in xl2007

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL2007 and XL2003 LeeCC Excel Discussion (Misc queries) 2 December 18th 08 04:44 PM
Upgrade options from XL2003/VBA/VB6 to XL2007/VB.NET ... Boesman Excel Programming 0 August 20th 07 04:57 PM
Run-Time Error 1004 When Running Pivot Table Code Chergh Excel Programming 0 August 2nd 07 04:16 PM
XL2007 vs XL2003 Art Excel Programming 10 April 21st 07 04:32 PM
Code Run-time error '1004' pjhageman[_5_] Excel Programming 3 January 11th 04 12:24 AM


All times are GMT +1. The time now is 05:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"