• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

I am trying to automate a process, please assist!

M0mster

New Member
This was supposed to be done yesterday... I am not a programmer, I just know enough to get myself into trouble. I have written a series of macros, most work very smoothly, but not this one! Your experience would be greatly appreciated!

Code:
Sub Incomingcode2()
'
' Issuerepair Macro
' test
'

'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\Users\KrisWiegman\Desktop\Client Name Work\Today\XXXOrders_USA_?.csv" _
        , Destination:=Range("$A$1"))
FindWhat:
        .Name = "XXXOrders_USA_?"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 65001
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
        1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .SheetDeactivate = 1
    End With
 End Sub
[/CODE}
 
This is the original code - with errors.
Code:
Sub BBYincoming()
'
' BBYincoming Macro
'
'
    With ActiveSheet.QueryTables.Add(Connection:=
    "TEXT;C:\Users\KrisWiegman\Desktop\Best Buy Work\Today\??.csv" _
        , Destination:=Range("$A$1"))
        Property Get CommandType(StoredProcedure)
        .Name = "BBYOrders_USA_??"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 65001
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
        1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
End Sub
 
Hi ,

When you have problems with macros , there are 2 things you can do to help others :

1. Specify the line which is responsible for Excel aborting execution

2. Upload your workbook with both the code and data in it.

The second is ideal , but at least the first is expected.

Narayan
 
Back
Top