Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default text in cell too long? run-time error

As I'm new here, Hi everyone!

I'm having a problem when I try to copy the content of a tex
containing cell to the clipboard.
Everytime the number of characters in the cell exceeds 1024 (1kb) ,
get the following error when running the copy-macro:
run-time error '1004': Application-defined or object-defined error.

The code I use for copying is the following:

Dim MyData As DataObject
Dim MyString As String

Set MyData = New DataObject

MyString = Range("B36").Formula

MyData.SetText MyString
MyData.PutInClipboard


Does anyone know how to overcome that limitation?

thanx in advanc

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default text in cell too long? run-time error

Change .Formula to .Value

A formula can only be 1024 characters long. Anyway, it worked fine for me
using .value when the constant string was longer than 1024 characters.

--
Regards,
Tom Ogilvy
"screeb " wrote in message
...
As I'm new here, Hi everyone!

I'm having a problem when I try to copy the content of a text
containing cell to the clipboard.
Everytime the number of characters in the cell exceeds 1024 (1kb) , i
get the following error when running the copy-macro:
run-time error '1004': Application-defined or object-defined error.

The code I use for copying is the following:

Dim MyData As DataObject
Dim MyString As String

Set MyData = New DataObject

MyString = Range("B36").Formula

MyData.SetText MyString
MyData.PutInClipboard


Does anyone know how to overcome that limitation?

thanx in advance


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default text in cell too long? run-time error

Is there a reason you are using DataObjects? Just using copy will put the
data on the clipboard. e.g.

Sub A()
'straight data copy without data objects
Cells(1, 1).Copy
Cells(2, 1).Select
ActiveSheet.Paste
End Sub

Sub B()
'or copy formula avoiding change in reference
Cells(2, 1).Formula = Cells(1, 1).Formula
End Sub

Displaying my ignorance, where did the DataObject thing come from anyway. I
can't see it anywhere in the object browser. Is it in a different library
you have loaded?

Robin Hammond
www.enhanceddatasystems.com

"screeb " wrote in message
...
As I'm new here, Hi everyone!

I'm having a problem when I try to copy the content of a text
containing cell to the clipboard.
Everytime the number of characters in the cell exceeds 1024 (1kb) , i
get the following error when running the copy-macro:
run-time error '1004': Application-defined or object-defined error.

The code I use for copying is the following:

Dim MyData As DataObject
Dim MyString As String

Set MyData = New DataObject

MyString = Range("B36").Formula

MyData.SetText MyString
MyData.PutInClipboard


Does anyone know how to overcome that limitation?

thanx in advance


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default text in cell too long? run-time error

duh, I just looked up in vb help how to copy data to the clipboard.
don't need to paste it in excel anywhere but in another program.
btw: the excel version we got here is '97

thanx for the tip with .value, I'm not used to excel macros as yo
might have noticed ;

--
Message posted from http://www.ExcelForum.com

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
Clearing cells takes long, long time unclemuffin Excel Discussion (Misc queries) 9 August 17th 07 02:22 AM
Error: The text string you entered is too long. GTVT06 Excel Worksheet Functions 2 June 16th 06 10:44 PM
Error: The text string you entered is too long. GTVT06 Excel Discussion (Misc queries) 0 June 16th 06 06:41 PM
Long Time to Enter Cell Values Joe Adams[_2_] Excel Programming 1 February 24th 04 06:06 PM


All times are GMT +1. The time now is 09:25 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"