[AccessD] Visual Basic error

Kathryn Bassett kathryn at bassett.net
Thu Sep 25 17:58:06 CDT 2003


Terri Jarus wrote an Excel VB macro for me, but I have a problem that seems to be version related. Too late to reach her at work as she's in MO and I'm in CA. Here is a shot of the code, and the error, though I'm also pasting in here.
http://www.ourmailinglist.org/misc/macroerror.jpg
"Compile Error: Named argument not found."

I've been surfing trying to find an answer and found the problem, just don't know how to solve it. I did a search on TrailingMinusNumbers and found this http://dbforums.com/arch/219/2003/4/769599
and it says "TrailingMinusNumbers is an argument that was introduced in 2002. If you want OpenText to work in earlier versions, you have to omit that argument."

I believe that's the problem because I have Excel 2000. So, my question is how do I omit the argument. I tried just erasing TrailingMinusNumbers:=True and recompiling but then get Expected named parameter - so I imagine there is more to omit, or that that is the wrong thing to omit.

Any ideas on how I can make this work?

--
Kathryn Rhinehart Bassett (Pasadena CA)
"Genealogy is my bag" "GH is my soap"
kathryn at bassett.net
http://bassett.net  

The full code is:
Sub getdata()
'
' getdata Macro
' Macro recorded 9/22/2003 by Terri Jarus
'
' Keyboard Shortcut: Ctrl+d
'
 Dim txtfile, savefile As String
 Application.Goto Reference:="R1C1"
 txtfile = InputBox("Enter last four digits of filename", "File Name", "D:\MyFiles\Access\AC100\2003\output*.txt")
 savefile = Mid(txtfile, 36, 10) & ".xls"
    Workbooks.OpenText Filename:= _
        txtfile, Origin:=437, StartRow _
        :=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
        ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _
        Space:=False, Other:=False, FieldInfo:=Array(Array(1, 9), Array(2, 9), Array( _
        3, 2), Array(4, 1), Array(5, 2), Array(6, 1), Array(7, 2)), TrailingMinusNumbers:=True
    Selection.EntireRow.Insert
    ActiveCell.FormulaR1C1 = "activity"
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "bib"
    Range("C1").Select
    ActiveCell.FormulaR1C1 = "timetext"
    Range("D1").Select
    ActiveCell.FormulaR1C1 = "day"
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "checkpoint"
    Range("A1").Select
    ActiveWorkbook.SaveAs Filename:= _
        savefile, _
        FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
        ReadOnlyRecommended:=False, CreateBackup:=False
    
End Sub




More information about the AccessD mailing list