Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Unable to get the Text property of the WorksheetFunction class

I have a spreadsheet that I'm exporting data to a text file from. It
reads each cell and prints them out in a specific way in the text
file. When the value of one of the cells gets a couple lines worth of
data, it give the error listed in the subject. The variable is
defined as a string. I copy and paste the content into notepad but do
not see any issues with carriage return or anything so not sure what's
going on here. If I shorten the length of the cell it works fine.
Anyone know what's going on here?

Thanks.

JR
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Unable to get the Text property of the WorksheetFunction class

show the actual code which produces the error

Tim.


"John" wrote in message
om...
I have a spreadsheet that I'm exporting data to a text file from. It
reads each cell and prints them out in a specific way in the text
file. When the value of one of the cells gets a couple lines worth of
data, it give the error listed in the subject. The variable is
defined as a string. I copy and paste the content into notepad but do
not see any issues with carriage return or anything so not sure what's
going on here. If I shorten the length of the cell it works fine.
Anyone know what's going on here?

Thanks.

JR



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Unable to get the Text property of the WorksheetFunction class

Tim,

Pretty Simple the part of the code that is erroring:

Dim comments As String

CellValue = _
Application.WorksheetFunction.Text
(Cells(RowNdx, ColNdx).Value, _
Cells(RowNdx, ColNdx).NumberFormat)

comments = CellValue

Print #FNum, "comments=" & comments

So it reads in each cell of each row and outputs the contents to a
text file. This code works fine for every field except for one that I
have not restricted. Figured out it seems I am running what I've read
on the internet is a 254 character limit or something. The field can
hold more than this, but when I try and read/write out that cell when
it exceeds this length it gives the above error.

Any ideas how to work around this? Does Excel 2003 still have this
problem? I'm working in Excel 2000 right now.

Thanks.

JR

"Tim Williams" <saxifrax at pacbell dot net wrote in message ...
show the actual code which produces the error

Tim.


"John" wrote in message
om...
I have a spreadsheet that I'm exporting data to a text file from. It
reads each cell and prints them out in a specific way in the text
file. When the value of one of the cells gets a couple lines worth of
data, it give the error listed in the subject. The variable is
defined as a string. I copy and paste the content into notepad but do
not see any issues with carriage return or anything so not sure what's
going on here. If I shorten the length of the cell it works fine.
Anyone know what's going on here?

Thanks.

JR

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Unable to get the Text property of the WorksheetFunction class

Tim,

Pretty Simple the part of the code that is erroring:

Dim comments As String

CellValue = _
Application.WorksheetFunction.Text
(Cells(RowNdx, ColNdx).Value, _
Cells(RowNdx, ColNdx).NumberFormat)

comments = CellValue

Print #FNum, "comments=" & comments

So it reads in each cell of each row and outputs the contents to a
text file. This code works fine for every field except for one that I
have not restricted. Figured out it seems I am running what I've read
on the internet is a 254 character limit or something. The field can
hold more than this, but when I try and read/write out that cell when
it exceeds this length it gives the above error.

Any ideas how to work around this? Does Excel 2003 still have this
problem? I'm working in Excel 2000 right now.

Thanks.

JR

"Tim Williams" <saxifrax at pacbell dot net wrote in message ...
show the actual code which produces the error

Tim.


"John" wrote in message
om...
I have a spreadsheet that I'm exporting data to a text file from. It
reads each cell and prints them out in a specific way in the text
file. When the value of one of the cells gets a couple lines worth of
data, it give the error listed in the subject. The variable is
defined as a string. I copy and paste the content into notepad but do
not see any issues with carriage return or anything so not sure what's
going on here. If I shorten the length of the cell it works fine.
Anyone know what's going on here?

Thanks.

JR

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Unable to get the Text property of the WorksheetFunction class

There does seem to be a limitation on the TEXT function.
If you're expecting the value of this field to be text, why not just use

Cells(RowNdx, ColNdx).Value

?

If you're writing this out to a file you might also want to strip out any CR
or LF characters.

Tim.



"John" wrote in message
om...
Tim,

Pretty Simple the part of the code that is erroring:

Dim comments As String

CellValue = _
Application.WorksheetFunction.Text
(Cells(RowNdx, ColNdx).Value, _
Cells(RowNdx, ColNdx).NumberFormat)

comments = CellValue

Print #FNum, "comments=" & comments

So it reads in each cell of each row and outputs the contents to a
text file. This code works fine for every field except for one that I
have not restricted. Figured out it seems I am running what I've read
on the internet is a 254 character limit or something. The field can
hold more than this, but when I try and read/write out that cell when
it exceeds this length it gives the above error.

Any ideas how to work around this? Does Excel 2003 still have this
problem? I'm working in Excel 2000 right now.

Thanks.

JR

"Tim Williams" <saxifrax at pacbell dot net wrote in message

...
show the actual code which produces the error

Tim.


"John" wrote in message
om...
I have a spreadsheet that I'm exporting data to a text file from. It
reads each cell and prints them out in a specific way in the text
file. When the value of one of the cells gets a couple lines worth of
data, it give the error listed in the subject. The variable is
defined as a string. I copy and paste the content into notepad but do
not see any issues with carriage return or anything so not sure what's
going on here. If I shorten the length of the cell it works fine.
Anyone know what's going on here?

Thanks.

JR





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Unable to get the Text property of the WorksheetFunction class

And maybe just this would be sufficient:

myComments = Cells(RowNdx, ColNdx).Text

But you can get "######" back when you look at .text--if the columnwidth is too
narrow for a number/time/date.

John wrote:

Tim,

Pretty Simple the part of the code that is erroring:

Dim comments As String

CellValue = _
Application.WorksheetFunction.Text
(Cells(RowNdx, ColNdx).Value, _
Cells(RowNdx, ColNdx).NumberFormat)

comments = CellValue

Print #FNum, "comments=" & comments

So it reads in each cell of each row and outputs the contents to a
text file. This code works fine for every field except for one that I
have not restricted. Figured out it seems I am running what I've read
on the internet is a 254 character limit or something. The field can
hold more than this, but when I try and read/write out that cell when
it exceeds this length it gives the above error.

Any ideas how to work around this? Does Excel 2003 still have this
problem? I'm working in Excel 2000 right now.

Thanks.

JR

"Tim Williams" <saxifrax at pacbell dot net wrote in message ...
show the actual code which produces the error

Tim.


"John" wrote in message
om...
I have a spreadsheet that I'm exporting data to a text file from. It
reads each cell and prints them out in a specific way in the text
file. When the value of one of the cells gets a couple lines worth of
data, it give the error listed in the subject. The variable is
defined as a string. I copy and paste the content into notepad but do
not see any issues with carriage return or anything so not sure what's
going on here. If I shorten the length of the cell it works fine.
Anyone know what's going on here?

Thanks.

JR


--

Dave Peterson
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
unable to get the pivotfields property of the pivottable class dhstein Excel Discussion (Misc queries) 0 January 6th 10 02:27 AM
"Unable to get the VLookup property of the WorksheetFunction class Ayo Excel Discussion (Misc queries) 4 August 6th 08 10:00 PM
"Unable to get the NormSInv property of the WorksheetFunction clas David Roodman Excel Worksheet Functions 1 December 15th 04 12:15 PM
Unable to get the Vlookup Property of the WorkSheetFunction Class monagan Excel Programming 2 August 3rd 04 09:32 PM
Unable to set the Locked property of the range class Stuart[_5_] Excel Programming 5 June 25th 04 03:32 PM


All times are GMT +1. The time now is 04:51 AM.

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

About Us

"It's about Microsoft Excel"