macro problems

  • Thread starter Thread starter John Garate
  • Start date Start date
J

John Garate

I wrote a macro with Excel 2002 on Windows XP. It runs fine. It uses the
Insert External data command to import a tab-delimited file into a
pre-formatted excel workbook.

However, when I load the worksheet (with the macro) on a Win98 second
edition platform running Excel 2000, I get the following error message:

Error 5: Invalid procedure, call or argument.

This occurs at the line: TextFilePlatform = 1252

I'm not sure if this is an Excel 2000 issue or a platform issue.


The full macro is:

Import_roster Macro
' Macro recorded 6/3/2004 by John A. Garate
'

'
Sheets("Roster").Select
Range("B3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;F:\Lectors\Tab files\roster.tab", Destination:=Range("B3"))
.Name = "roster"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierNone
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
 
John,

I don't use QueryTables, but looking it up in help, it suggests that the
TextFilePlatform property can have one of 3 values, xlMacintosh, xlMSDOS, or
xlWindows (1, 3 or 2), so I am not sure where you get 1252 from. Could I
suggest that you try it with a value of 2?

Alternatively, re-record the macro on the Win98 machine and see what
differences you get.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top