Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default getting error out of memory

I'm Importing data from a text file to Excel, and everything is ok if I have
data in my text file, but I'm getting an out of memory error message at a
..Refresh BackgroundQuery:=False when my text file doesn't have data.

How can I test if my text file is empty or not?

Could somebody tell me why or what could I do about it???
this is my code...

Range("A2").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Hilda\Excel\WorryParts\WP1", Destination:=Range("A2"))
.Name = "WP1_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

Thanks a lot.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default getting error out of memory

Test it with something like

if Dir("C:\Hilda\Excel\WorryParts\WP1") < "" Then
if filelen(C:\Hilda\Excel\WorryParts\WP1) 100 then
' now your code.

End if
End if

--
Regards,
Tom Ogilvy

"Hilda" wrote in message
...
I'm Importing data from a text file to Excel, and everything is ok if I

have
data in my text file, but I'm getting an out of memory error message at a
.Refresh BackgroundQuery:=False when my text file doesn't have data.

How can I test if my text file is empty or not?

Could somebody tell me why or what could I do about it???
this is my code...

Range("A2").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Hilda\Excel\WorryParts\WP1", Destination:=Range("A2"))
.Name = "WP1_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

Thanks a lot.



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
How to handle error 8007000e Memory Error L. A. M. Excel Programming 6 June 28th 05 04:05 AM
Out of Memory Error Edgar Thoemmes Excel Programming 1 January 25th 04 01:52 PM
Out of Memory Error Charlie Tuna Excel Programming 0 November 11th 03 12:28 PM
Out of Memory error Charlie Tuna Excel Programming 0 November 11th 03 12:27 PM
Out of memory error. LHW[_2_] Excel Programming 0 August 27th 03 06:51 AM


All times are GMT +1. The time now is 03:25 PM.

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"