hi
Summary: Every day a spreadsheet is extracted and saved in. Csv file with the name "Consolidated" followed by the date of extraction, for example, was saved well today "Consolidated 05-01". My macro just need to get the data from this spreadsheet that is saved in the same location on the server.
Problem: It is debugging with error 1004, I have a slight idea of what it is because it is not recognizing the leading zero in the worksheet name. For last month, from the day 22/12 (Day / Month), when I started to run the macro, never had this problem. Only from that year did you start debugging. So, I think the problem lies in the variable String or Integer.
I thank you.
Below is the code for programming.
Code:Sub Organizando_Planilha() Dim ul As String Dim DIA As String Dim MES As Integer Sheets("Filas Encaminhadas").Select DIA = Day(Now()) MES = Month(Now()) Sheets("Filas Encaminhadas").Select With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;\\Btgo3015\centro_solucoes$\OUVIDORIA\COE\SAULO EDUARDO\Relatórios\Consolidado " & DIA & "-" & MES & ".csv" _ , Destination:=Range("$A$1")) .Name = "Consolidado " & DIA & "-" & MES .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 = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = True .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With End Sub


Reply With Quote
Bookmarks