LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 1004 error - can't find text file to refresh ...

I have 2 procedures in a module. One imports external data (.csv) to a named
sheet (which works) then calls another procedure wthich imports a .dat file.
I'm getting the error above during the second import. I have checked using
debug.print and the file path is correct. The last line of code (.Refresh...)
is causing my problem. Here's my code. Any ideas?

Thanks
LeAnn

CODE:
Sub ImportData(strFile As String)
'

Dim strDir As String
strDir = "my network path" & strFile

With Worksheets("Result")
.Select
.Range("a1").Select
End With

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & strDir _
, Destination:=Range("Q22"))
.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 = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub

 
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
VBA "1004" error when .Refresh BackgroundQuery:=False Dennis Excel Programming 2 July 25th 07 02:30 PM
VBA Find produces 1004 error Andy Excel Programming 3 September 26th 06 07:31 PM
runtime error 1004 saveas text file Janis Excel Programming 2 September 1st 06 11:11 PM
Error 1004 in printing .ps (postscript) file from .xls file chemburkar[_2_] Excel Programming 2 February 5th 04 11:33 PM
Error 1004 when I open a file Deer Hunter Excel Programming 3 August 27th 03 05:33 PM


All times are GMT +1. The time now is 12:09 PM.

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

About Us

"It's about Microsoft Excel"