ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro problems (https://www.excelbanter.com/excel-programming/320584-macro-problems.html)

John Garate

macro problems
 
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 Garate




Bob Phillips[_6_]

macro problems
 
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)


"John Garate" wrote in message
...
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 Garate







All times are GMT +1. The time now is 12:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com