Hy all. Guys i have a problem, i made a program which uses a .rtf file as datasource, but this program will be spreaded to much users so the source of the .rtf file should be the same as workbooks's source.
here is the code
Sub ImportFieldPlayer()
'
' ImportFieldPlayer Macro
'
'
Cells.Select
Selection.QueryTable.Delete
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\player.rtf" _
, Destination:=Range("$A$1"))
.Name = "28. João Luís Pereira Cerqueira"
.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 = True
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileOtherDelimiter = "|"
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Dim position As Integer
position = Worksheets("Other").Cells(1, 1).Value
Sheets("FM").Select
Range(Cells(1, 1), Cells(1, position)).Select
Selection.Copy
Sheets("Other").Select
ActiveSheet.Paste
End Sub
I tried sth like this
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;ThisWorkBoot.Path\player.rtf" _
, Destination:=Range("$A$1"))
but this didn't work.
Where i`m wrong
Bookmarks