![]() |
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 |
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/ |
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/ |
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 |
All times are GMT +1. The time now is 05:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com