Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Retrieving data from Excel and store it into string variable


Hi All,

I create an excel object in VB and store the data from the spreadshee
into a local variable called strTemp. However, error occurs when th
data field is larger than 255 characters. Excel automatically truncat
the data to 255 chars and gives out error:

"Arguments are of the wrong type, are out of acceptable range, or ar
in conflict with one another"

Is there anyway to fix this?

Thanx in advance.

Regards,
Ma

--
marsulei
-----------------------------------------------------------------------
marsulein's Profile: http://www.excelforum.com/member.php...fo&userid=1606
View this thread: http://www.excelforum.com/showthread.php?threadid=27520

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Retrieving data from Excel and store it into string variable

marsulein,
How do you DIMension "strTemp" ?
And how are trying to set its value ?

NickHK


"marsulein" wrote in message
...

Hi All,

I create an excel object in VB and store the data from the spreadsheet
into a local variable called strTemp. However, error occurs when the
data field is larger than 255 characters. Excel automatically truncate
the data to 255 chars and gives out error:

"Arguments are of the wrong type, are out of acceptable range, or are
in conflict with one another"

Is there anyway to fix this?

Thanx in advance.

Regards,
Mar


--
marsulein
------------------------------------------------------------------------
marsulein's Profile:

http://www.excelforum.com/member.php...o&userid=16064
View this thread: http://www.excelforum.com/showthread...hreadid=275204



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Retrieving data from Excel and store it into string variable

marsulein wrote ...

I create an excel object in VB and store the data from the spreadsheet
into a local variable called strTemp. However, error occurs when the
data field is larger than 255 characters. Excel automatically truncate
the data to 255 chars and gives out error:

"Arguments are of the wrong type, are out of acceptable range, or are
in conflict with one another"

Is there anyway to fix this?


It sounds like the data type of the Excel column is being determined
as TEXT, which is limited to 255 characters. The data type you require
is MEMO.

You can test the data type in you code using:

Select Case objExcel.Fields("Name").Type
Case adLongVarWChar
MsgBox "MEMO"
Case adVarWChar
MsgBox "TEXT"
End Select

How do you determine the data type for an Excel column? Well, you
can't, it is done for you using the data present in the column at the
time the query is executed and may be influenced by settings in the
connection string and the registry. For details, see:

http://www.dicks-blog.com/excel/2004...al_data_m.html

Jamie.

--
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
To store the formula in a string pol Excel Discussion (Misc queries) 4 December 2nd 08 02:14 PM
retrieving data from variable workbooks lutan Excel Discussion (Misc queries) 3 August 14th 07 01:08 PM
Retrieving Cell Data From Variable Files DJ Pomeroy Excel Worksheet Functions 3 April 24th 07 08:32 PM
Can one store a string in a Array element? [email protected] Excel Discussion (Misc queries) 1 April 17th 07 12:53 PM
Store variable value for Chart Al Jager Excel Programming 1 February 19th 04 10:58 AM


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