Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSV file import failing since Windows 10 update

Status
Not open for further replies.

rogerte

Programmer
Nov 9, 2001
164
GB
Hi,

I am using Excel 2007, and have used a daily CSV import routine for the last 6 years on Win 7 and 8.1 with no problems.

Since the PC updated to Win 10 (I didn't mean to, but pressed wrong button!) it has failed during the import routine at the TextFilePlatform line, with an Invalid Procedure Call error.

Code:
With Worksheets("Temp").QueryTables.Add(Connection:=connectionName, Destination:=Worksheets("Temp").Range("A" & Lastrow))
        .Name = filename
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlOverwriteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        [b].TextFilePlatform = 437[/b]
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .Refresh BackgroundQuery:=False
End With

I have tried using different codepage values e.g. 850 instead of 437, but still get same error message.

Any ideas

Thanks


 
I have just tried xlMSDos instead of the codepage value and that run ok.

So it looks like Win10 is unhappy about using codepage values and prefers just xlMSDOS, xlWindows etc. as values for TextFilePlatform

Cheers




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top