Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro To Import Text File

I have a space delimmited text file. I have read up on how to import
this using VBA and come across the script at this site

http://www.cpearson.com/excel/imptext.htm

This worked great until I imported a text file with 32767 rows in. (I
doubt it is coincedence that this is exactly 50% of the top limit)

I don't think the results will ever be over the limit of 65536 so I do
not need to use any error checking for that.

Basically I get an error stating "Runtime Error 6 Overflow" and when I
stop the macro I notice all text has been imported up to row 32767

Can anyone help?

Thanks if you can

Dan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro To Import Text File

I think this is an issue with the Integer limit.

Integer variables are stored as 16-bit (2-byte) numbers ranging in value
from -32,768 to 32,767.

Chnage the code for:
Dim RowNdx As Integer to Dim RowNdx As Long



wrote in message
ups.com...
I have a space delimmited text file. I have read up on how to import
this using VBA and come across the script at this site

http://www.cpearson.com/excel/imptext.htm

This worked great until I imported a text file with 32767 rows in. (I
doubt it is coincedence that this is exactly 50% of the top limit)

I don't think the results will ever be over the limit of 65536 so I do
not need to use any error checking for that.

Basically I get an error stating "Runtime Error 6 Overflow" and when I
stop the macro I notice all text has been imported up to row 32767

Can anyone help?

Thanks if you can

Dan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro To Import Text File

Thanks a million!

That beastie worked a treat. I owe you a pint of cold lager :)

DKIM wrote:

I think this is an issue with the Integer limit.

Integer variables are stored as 16-bit (2-byte) numbers ranging in value
from -32,768 to 32,767.

Chnage the code for:
Dim RowNdx As Integer to Dim RowNdx As Long



wrote in message
ups.com...
I have a space delimmited text file. I have read up on how to import
this using VBA and come across the script at this site

http://www.cpearson.com/excel/imptext.htm

This worked great until I imported a text file with 32767 rows in. (I
doubt it is coincedence that this is exactly 50% of the top limit)

I don't think the results will ever be over the limit of 65536 so I do
not need to use any error checking for that.

Basically I get an error stating "Runtime Error 6 Overflow" and when I
stop the macro I notice all text has been imported up to row 32767

Can anyone help?

Thanks if you can

Dan


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Macro To Import Text File

Yes, that was a mistake in my code to declare RowNdx as an Integer. As you
have seen, it needs to be declared As Long. The problem never got caught
during testing because I never imported a file with more that 32K rows.

If you're importing more the 64K rows, see
http://www.cpearson.com/excel/ImportBigFiles.htm for procedures to a import
unlimited number of rows.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)

wrote in message
ups.com...
Thanks a million!

That beastie worked a treat. I owe you a pint of cold lager :)

DKIM wrote:

I think this is an issue with the Integer limit.

Integer variables are stored as 16-bit (2-byte) numbers ranging in value
from -32,768 to 32,767.

Chnage the code for:
Dim RowNdx As Integer to Dim RowNdx As Long



wrote in message
ups.com...
I have a space delimmited text file. I have read up on how to import
this using VBA and come across the script at this site

http://www.cpearson.com/excel/imptext.htm

This worked great until I imported a text file with 32767 rows in. (I
doubt it is coincedence that this is exactly 50% of the top limit)

I don't think the results will ever be over the limit of 65536 so I do
not need to use any error checking for that.

Basically I get an error stating "Runtime Error 6 Overflow" and when I
stop the macro I notice all text has been imported up to row 32767

Can anyone help?

Thanks if you can

Dan




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
Skipping Import Text File dialog in a Macro Leon Excel Discussion (Misc queries) 5 January 21st 08 09:12 PM
Macro to import text file and update calculation to include new co Admirera Excel Programming 0 May 24th 06 10:09 PM
Macro Import Text File, File Name Bob S[_3_] Excel Programming 2 March 23rd 06 10:01 PM
How do I import text file, analyze data, export results, open next file Geoffro Excel Programming 2 March 6th 05 08:02 PM
Import text file without specifying a path macro won't work Bruiser Excel Programming 3 January 20th 04 11:47 PM


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