hi Shaun,
I am trying to get the macro to prompt a dialog box which my user would
input a file name (.tab) and then have my macro continue its work.
Here is what I have done so far (see macro below) but it will only open file
123123.tab. The file name is always in the same directory but the name
changes every day.
Hope you can help, thanks
Sub george()
'
' george Macro
' Macro recorded 3/30/2005 by marie
'
'
Application.Goto Reference:="R1C105"
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DBQ=G:\COSTING\LOBLAWS\TAB FILES;DefaultDir=G:
\COSTING\LOBLAWS\TAB FILES;Driver={Driver da Microsoft para arquivos texto
(*.txt" _
), Array( _
";
*.csv)};DriverId=27;FIL=text;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;"
_
)), Destination:=Range("DA1"))
.CommandText = Array("SELECT * FROM `123123.tab`")
.Name = "LOBLAWS"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceConnectionFile = _
"C:\Program Files\Common Files\ODBC\Data Sources\LOBLAWS.dsn"
.Refresh BackgroundQuery:=False
End With
End Sub