Advertisement

09.10.2007 at 08:33AM PDT, ID: 22817960
[x]
Attachment Details

Object Required error when VBA code run

Asked by HTC1898 in Access Coding/Macros, Microsoft Access Database

Tags: object, required, vba, error

I have an Access database that I am trying to use to take 24 delimited files and save them as Excel.  There are 24 files and they are quite large and I only need some of the data.  So I have linked the Excel files to my Access db and have a union query that unites all the files and only pulls the data I need from the files and then an append query that adds that data to a table.  The reason I need to do this regularly is that the files change every week.  So every week I need to take these refreshed text files, overwrite the existing Excel files so the existing link has the fresh data, so I can unite them and save only the needed data to an existing table.  I hope that wasn't to much info.  Anyway, I had code working in my test db.  As soon as I moved it to my real db, it doesn't work.  I get an "object required" error.  There is no error number or anything on the error message.  I was running some test codes before this code in my test db so I am not sure if one of those allowed this to work but now I moved it to my real db where those test codes weren't run it doesn't allow this one to work?  I am not very familar with VBA so I am sure it is something easy but I just can't figure it out.  Can someone please help me fix this error??  Thanks.  Here is the code:

Option Compare Database

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

DoCmd.SetWarnings False
ChDir "P:\Revenue Assurance"
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.AC32.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "AC32"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "AC32"
    Dim lastrow As Long
    lastrow = Worksheets("ascii.AC32").Range("A1").End(xlDown).Row
    With Worksheets("ascii.AC32").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-AC32.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.AC5001.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "AC50"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "AC50"
    lastrow = Worksheets("ascii.AC5001").Range("A1").End(xlDown).Row
    With Worksheets("ascii.AC5001").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-AC5001.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.CO01.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "CO01"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "CO01"
    lastrow = Worksheets("ascii.CO01").Range("A1").End(xlDown).Row
    With Worksheets("ascii.CO01").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-CO01.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.CO02.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "CO02"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "CO02"
    lastrow = Worksheets("ascii.CO02").Range("A1").End(xlDown).Row
    With Worksheets("ascii.CO02").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-CO02.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.FRBL01.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "FRBL01"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "FRBL01"
    lastrow = Worksheets("ascii.FRBL01").Range("A1").End(xlDown).Row
    With Worksheets("ascii.FRBL01").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-FRBL01.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.FRBL07.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "FRBL07"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "FRBL07"
    lastrow = Worksheets("ascii.FRBL07").Range("A1").End(xlDown).Row
    With Worksheets("ascii.FRBL07").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-FRBL07.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.FRBL13.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "FRBL13"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "FRBL13"
    lastrow = Worksheets("ascii.FRBL13").Range("A1").End(xlDown).Row
    With Worksheets("ascii.FRBL13").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-FRBL13.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.FRBL19.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "FRBL19"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "FRBL19"
    lastrow = Worksheets("ascii.FRBL19").Range("A1").End(xlDown).Row
    With Worksheets("ascii.FRBL19").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-FRBL19.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.FRBL25.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "FRBL25"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "FRBL25"
    lastrow = Worksheets("ascii.FRBL25").Range("A1").End(xlDown).Row
    With Worksheets("ascii.FRBL25").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-FRBL25.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.LKCR01.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "LKCR01"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "LKCR01"
    lastrow = Worksheets("ascii.LKCR01").Range("A1").End(xlDown).Row
    With Worksheets("ascii.LKCR01").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-LKCR01.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.NWLD01.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "NWLD01"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "NWLD01"
    lastrow = Worksheets("ascii.NWLD01").Range("A1").End(xlDown).Row
    With Worksheets("ascii.NWLD01").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-NWLD01.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.STCL.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "STCL"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "STCL"
    lastrow = Worksheets("ascii.STCL").Range("A1").End(xlDown).Row
    With Worksheets("ascii.STCL").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-STCL.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.STPR1.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "STPR1"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "STPR1"
    lastrow = Worksheets("ascii.STPR1").Range("A1").End(xlDown).Row
    With Worksheets("ascii.STPR1").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-STPR1.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.STPR2.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "STPR2"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "STPR2"
    lastrow = Worksheets("ascii.STPR2").Range("A1").End(xlDown).Row
    With Worksheets("ascii.STPR2").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-STPR2.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.STPR3.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "STPR3"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "STPR3"
    lastrow = Worksheets("ascii.STPR3").Range("A1").End(xlDown).Row
    With Worksheets("ascii.STPR3").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-STPR3.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.STPR4.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "STPR4"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "STPR4"
    lastrow = Worksheets("ascii.STPR4").Range("A1").End(xlDown).Row
    With Worksheets("ascii.STPR4").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-STPR4.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.STPR5.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "STPR5"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "STPR5"
    lastrow = Worksheets("ascii.STPR5").Range("A1").End(xlDown).Row
    With Worksheets("ascii.STPR5").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-STPR5.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.URDL01.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "URDL01"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "URDL01"
    lastrow = Worksheets("ascii.URDL01").Range("A1").End(xlDown).Row
    With Worksheets("ascii.URDL01").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-URDL01.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.WASC01.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "WASC01"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "WASC01"
    lastrow = Worksheets("ascii.WASC01").Range("A1").End(xlDown).Row
    With Worksheets("ascii.WASC01").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-WASC01.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.WASC07.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "WASC07"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "WASC07"
    lastrow = Worksheets("ascii.WASC07").Range("A1").End(xlDown).Row
    With Worksheets("ascii.WASC07").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-WASC07.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.WASC13.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "WASC13"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "WASC13"
    lastrow = Worksheets("ascii.WASC13").Range("A1").End(xlDown).Row
    With Worksheets("ascii.WASC13").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-WASC13.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.WASC19.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "WASC19"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "WASC19"
    lastrow = Worksheets("ascii.WASC19").Range("A1").End(xlDown).Row
    With Worksheets("ascii.WASC19").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-WASC19.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.WAUK01.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "WAUK01"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "WAUK01"
    lastrow = Worksheets("ascii.WAUK01").Range("A1").End(xlDown).Row
    With Worksheets("ascii.WAUK01").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-WAUK01.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    Workbooks.OpenText Filename:= _
        "P:\Revenue Assurance\ascii.WAUK02.2007", Origin:= _
        xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=True, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
        Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 1), Array(6, 1), Array(7 _
        , 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
        (14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1))
    Range("HB1").Select
    ActiveCell.FormulaR1C1 = "WAUK02"
    Range("HB2").Select
    ActiveCell.FormulaR1C1 = "WAUK02"
    lastrow = Worksheets("ascii.WAUK02").Range("A1").End(xlDown).Row
    With Worksheets("ascii.WAUK02").Range(" HB1:HB2").Select
    Selection.AutoFill Destination:=Range("HB1:HB" & lastrow&)
    End With
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Revenue Assurance\View1-WAUK02.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    DoCmd.SetWarnings True

Exit_Command0_Click:
    Exit Sub

Err_Command0_Click:
    MsgBox Err.Description
    Resume Exit_Command0_Click

End SubStart Free Trial
[+][-]09.10.2007 at 08:42AM PDT, ID: 19861760

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Microsoft Access Database
Tags: object, required, vba, error
Sign Up Now!
Solution Provided By: capricorn1
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.10.2007 at 09:04AM PDT, ID: 19861929

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.10.2007 at 09:10AM PDT, ID: 19861966

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.10.2007 at 09:21AM PDT, ID: 19862053

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.10.2007 at 10:01AM PDT, ID: 19862375

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628