Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, The '.Refresh BackgroundQuery:=False' error is being received in thi case because the variable is set in a different private sub, so Privat Sub btnCombine_Click() does not know what strFirstFileName is. I'v copied your code and justed tweaked a bit: Code ------------------- PUBLIC STRFIRSTFILENAME AS STRIN Private Sub btnCombine_Click() Dim intLastrow intLastrow = Cells(65536, 1).End(xlUp).Row With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;" & strFirstFileName _ , Destination:=Cells(intLastrow + 1, 1)) .Name = "BENT 2 -Final0022" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 437 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .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, 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 Private Sub btnFirstFileName_Click() strFirstFileName = Application.GetOpenFilename txtFirstFileName.Text = strFirstFileName End Su ------------------- Hope this helps, -- ben7 ----------------------------------------------------------------------- ben77's Profile: http://www.excelforum.com/member.php...fo&userid=3560 View this thread: http://www.excelforum.com/showthread.php?threadid=55370 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Missing Cloumn data when importing external data | Excel Discussion (Misc queries) | |||
Importing:Data Connection Wizard Doesn't see Source Data - No Impo | Excel Discussion (Misc queries) | |||
Removing Data Tables formed from importing data from Access | Excel Discussion (Misc queries) | |||
Importing Data: OLE DB and data link properties dialog | Excel Discussion (Misc queries) | |||
Importing data, then adding data to the new spreadsheet.. a conund | Excel Discussion (Misc queries) |