+ Reply to Thread
Results 1 to 2 of 2

Recorded Macro "Invalid procedure or call argument" Error

Hybrid View

lilit2222 Recorded Macro "Invalid... 07-03-2020, 02:31 AM
nankw83 Re: Recorded Macro "Invalid... 07-03-2020, 05:04 AM
  1. #1
    Registered User
    Join Date
    07-01-2020
    Location
    Yerevan
    MS-Off Ver
    2010
    Posts
    44

    Recorded Macro "Invalid procedure or call argument" Error

    Hi,

    I have recorded macro to automate some of the import wizard functions. So, Basically I imported text file (fixed with), then performed some editing (deleting rows columns and etc.). Then I stopped recording.

    However when I try to run macro, it gives "Invalid procedure or call argument". The error is given on the 4th line i.e. .CommandType=0

    Can someone help me, please?



    '
        With ActiveSheet.QueryTables.Add(Connection:= _
            "TEXT;C:\Users\emil abrahamyan\Desktop\Rubbish\AS5EB3.txt", Destination:= _
            Range("$A$1"))
            .CommandType = 0
            .Name = "AS5EB3"
            .FieldNames = True
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = True
            .RefreshOnFileOpen = False
            .RefreshStyle = xlInsertDeleteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = True
            .RefreshPeriod = 0
            .TextFilePromptOnRefresh = False
            .TextFilePlatform = 1252
            .TextFileStartRow = 1
            .TextFileParseType = xlFixedWidth
            .TextFileTextQualifier = xlTextQualifierDoubleQuote
            .TextFileConsecutiveDelimiter = False
            .TextFileTabDelimiter = True
            .TextFileSemicolonDelimiter = False
            .TextFileCommaDelimiter = False
            .TextFileSpaceDelimiter = False
            .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1)
            .TextFileFixedColumnWidths = Array(9, 33, 20, 21, 38)
            .TextFileTrailingMinusNumbers = True
            .Refresh BackgroundQuery:=False
        End With
        Cells.Select
        With Selection.Font
            .Name = "Arial Armenian"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontNone
        End With
        Range("A1").Select
        ActiveCell.FormulaR1C1 = "îåí³Í ¿ §"
        Range("A2").Select
        Selection.EntireRow.Delete
        Range("A981").Select
        ActiveCell.FormulaR1C1 = "‰‰‰‰‰‰‰‰‰"
        Range("A972").Select
        Selection.FillDown
        Selection.EntireRow.Delete
        Range("A970").Select
        ActiveCell.FormulaR1C1 = "ÀݹѳÝáõ"
        Selection.EntireRow.Delete
        ActiveWindow.ScrollRow = 970
        ActiveWindow.ScrollRow = 966
        ActiveWindow.ScrollRow = 957
        ActiveWindow.ScrollRow = 942
        ActiveWindow.ScrollRow = 923
        ActiveWindow.ScrollRow = 893
        ActiveWindow.ScrollRow = 459
        ActiveWindow.ScrollRow = 413
        ActiveWindow.ScrollRow = 300
        ActiveWindow.ScrollRow = 108
        ActiveWindow.ScrollRow = 89
        ActiveWindow.ScrollRow = 80
        ActiveWindow.ScrollRow = 1
        Range("A26").Select
        ActiveCell.FormulaR1C1 = "Øݳóáñ¹"
        Range("A19").Select
        Selection.EntireRow.Delete
        ActiveWindow.ScrollRow = 849
        ActiveWindow.ScrollRow = 837
        ActiveWindow.ScrollRow = 822
        ActiveWindow.ScrollRow = 697
        ActiveWindow.ScrollRow = 642
        ActiveWindow.ScrollRow = 526
        ActiveWindow.ScrollRow = 178
        ActiveWindow.ScrollRow = 136
        ActiveWindow.ScrollRow = 18
        ActiveWindow.ScrollRow = 6
        ActiveWindow.ScrollRow = 2
        ActiveWindow.ScrollRow = 1
        Range("A1").Select
        ActiveCell.FormulaR1C1 = "_________"
        Selection.EntireRow.Delete
        ActiveWindow.SmallScroll Down:=12
        Range("A801").Select
        ActiveCell.FormulaR1C1 = "ì»ñçݳϳ"
        Selection.EntireRow.Delete
        ActiveWindow.ScrollRow = 776
        ActiveWindow.ScrollRow = 775
        ActiveWindow.ScrollRow = 770
        ActiveWindow.ScrollRow = 765
        ActiveWindow.ScrollRow = 755
        ActiveWindow.ScrollRow = 742
        ActiveWindow.ScrollRow = 663
        ActiveWindow.ScrollRow = 649
        ActiveWindow.ScrollRow = 619
        ActiveWindow.ScrollRow = 606
        ActiveWindow.ScrollRow = 590
        ActiveWindow.ScrollRow = 446
        ActiveWindow.ScrollRow = 433
        ActiveWindow.ScrollRow = 420
        ActiveWindow.ScrollRow = 406
        ActiveWindow.ScrollRow = 278
        ActiveWindow.ScrollRow = 268
        ActiveWindow.ScrollRow = 260
        ActiveWindow.ScrollRow = 253
        ActiveWindow.ScrollRow = 246
        ActiveWindow.ScrollRow = 239
        ActiveWindow.ScrollRow = 229
        ActiveWindow.ScrollRow = 136
        ActiveWindow.ScrollRow = 129
        ActiveWindow.ScrollRow = 123
        ActiveWindow.ScrollRow = 118
        ActiveWindow.ScrollRow = 112
        ActiveWindow.ScrollRow = 106
        ActiveWindow.ScrollRow = 99
        ActiveWindow.ScrollRow = 92
        ActiveWindow.ScrollRow = 46
        ActiveWindow.ScrollRow = 39
        ActiveWindow.ScrollRow = 35
        ActiveWindow.ScrollRow = 30
        ActiveWindow.ScrollRow = 25
        ActiveWindow.ScrollRow = 20
        ActiveWindow.ScrollRow = 15
        ActiveWindow.ScrollRow = 9
        ActiveWindow.ScrollRow = 1
        Range("E13").Select
        ActiveCell.FormulaR1C1 = "ØÇçÝáñ¹³í׳ñ ѳß. Ùáõïù. ÙÇçáóÝ»ñÇ"
        Range("C4").Select
        Selection.EntireRow.Delete
        ActiveWindow.ScrollRow = 760
        ActiveWindow.ScrollRow = 759
        ActiveWindow.ScrollRow = 756
        ActiveWindow.ScrollRow = 753
        ActiveWindow.ScrollRow = 747
        ActiveWindow.ScrollRow = 690
        ActiveWindow.ScrollRow = 672
        ActiveWindow.ScrollRow = 650
        ActiveWindow.ScrollRow = 622
        ActiveWindow.ScrollRow = 185
        ActiveWindow.ScrollRow = 163
        ActiveWindow.ScrollRow = 146
        ActiveWindow.ScrollRow = 130
        ActiveWindow.ScrollRow = 85
        ActiveWindow.ScrollRow = 73
        ActiveWindow.ScrollRow = 68
        ActiveWindow.ScrollRow = 62
        ActiveWindow.ScrollRow = 56
        ActiveWindow.ScrollRow = 19
        ActiveWindow.ScrollRow = 18
        ActiveWindow.ScrollRow = 16
        ActiveWindow.ScrollRow = 15
        ActiveWindow.ScrollRow = 13
        ActiveWindow.ScrollRow = 12
        ActiveWindow.ScrollRow = 9
        ActiveWindow.ScrollRow = 6
        ActiveWindow.ScrollRow = 5
        ActiveWindow.ScrollRow = 3
        ActiveWindow.ScrollRow = 2
        ActiveWindow.ScrollRow = 1
        Rows("1:13").Select
        Range("B1").Activate
        Selection.Delete Shift:=xlUp
        ActiveWindow.ScrollColumn = 1
        Columns("B:B").Select
        Selection.Delete Shift:=xlToLeft
        ActiveWindow.SmallScroll Down:=216
        Columns("A:A").Select
        Range("A217").Activate
        Selection.SpecialCells(xlCellTypeBlanks).Select
        Range("B14").Select
        ActiveWindow.SmallScroll Down:=-66
        Rows("1:1").Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("A1").Select
        ActiveCell.FormulaR1C1 = "Date"
        Range("B1").Select
        ActiveCell.FormulaR1C1 = "Debit"
        Range("C1").Select
        ActiveCell.FormulaR1C1 = "Credit"
        Range("D1").Select
        ActiveCell.FormulaR1C1 = "Purpuse"
        Range("E1").Select
        ActiveCell.FormulaR1C1 = "Party"
        Range("D14").Select
        ActiveWindow.SmallScroll Down:=-33
        ActiveWindow.ScrollColumn = 1
    End Sub

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Recorded Macro "Invalid procedure or call argument" Error

    Hi lilit2222,

    Can you post a sample of your text file & the expected results in excel sheet after the changes you want to make so members could suggest some code for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. I am getting this error by below macro "Invalid procedure call arguement" please help
    By shoaibaligwl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2017, 09:39 AM
  2. help with "invalid procedure call or argument" error.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2017, 11:41 AM
  3. [SOLVED] run time error '5" invalid procedure call or argument
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-12-2015, 12:29 PM
  4. Run-time Error 5 "Invalid Procedure Call or Argument"
    By dinakar.yadav in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2014, 09:22 AM
  5. WritetoSheet causing "invalid procedure call or argument"
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2013, 03:46 PM
  6. Macro Error - Invalid Procedure Call or Argument
    By mcordi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-12-2011, 05:40 PM
  7. "Invalid procedure call or argument" error when creating Pivot table
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2009, 06:02 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1