|
首先请问的是外部导入网上数据能否实现在一个工作表里同时使用2个网上链接或多个网上链接?如果可以,那么www.17500.cn/getData/3d.TXT和http://www.17500.cn/getData/p5.TXT如何实现在一个工作表里工作?目前我可以实现的是分别在2个单独的工作表里能够工作,我想使其能在一个工作表里一次性导入上面两个链接的数据。请老师出手调整下,谢谢!!!
附代码,一:
Private Sub CommandButton1_Click()
Range("A3:Q8000").Clear
k3dshijihao = "http://www.17500.cn/getData/3d.TXT"
d3s = "WData3D_All"
Cells(2, 1) = "开奖期号"
Cells(2, 2) = "开奖日期"
Cells(2, 3) = "开"
Cells(2, 4) = "奖"
Cells(2, 5) = "号"
Cells(2, 6) = "试"
Cells(2, 7) = "机"
Cells(2, 8) = "号"
Cells(2, 9) = "机"
Cells(2, 10) = "球"
Cells(2, 11) = "投注总额"
Cells(2, 12) = "单选注数"
Cells(2, 13) = "金额"
Cells(2, 14) = "组三注数"
Cells(2, 15) = "金额"
Cells(2, 16) = "组六注数"
Cells(2, 17) = "金额"
cz = k3dshijihao: czmc = d3s
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & cz, Destination:=Range("A3"))
.Name = czmc
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Range("A" & (Application.Count(Range("a1:a8000")))).Select
End
End Sub
附代码,二:
Private Sub CommandButton1_Click()
Range("Z3:AP8000").Clear
k3dshijihao = "http://www.17500.cn/getData/p5.TXT"
d3s = "WData3D_All"
Cells(2, 1) = "开奖期号"
Cells(2, 2) = "开奖日期"
Cells(2, 3) = "开"
Cells(2, 4) = "奖"
Cells(2, 5) = "号"
Cells(2, 6) = " "
Cells(2, 7) = " "
Cells(2, 8) = "投注总额"
Cells(2, 9) = "中奖注数"
Cells(2, 10) = "单注奖金"
cz = k3dshijihao: czmc = d3s
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & cz, Destination:=Range("Z3"))
.Name = czmc
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 2, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Range("A" & (Application.Count(Range("Z1:Z8000")))).Select
End
End Sub
- Sub tset()
- k3dshijihao = "http://www.17500.cn/getData/3d.TXT"
- d3s = "WData3D_All"
- Cells(2, 1) = "开奖期号"
- Cells(2, 2) = "开奖日期"
- Cells(2, 3) = "开"
- Cells(2, 4) = "奖"
- Cells(2, 5) = "号"
- Cells(2, 6) = "试"
- Cells(2, 7) = "机"
- Cells(2, 8) = "号"
- Cells(2, 9) = "机"
- Cells(2, 10) = "球"
- Cells(2, 11) = "投注总额"
- Cells(2, 12) = "单选注数"
- Cells(2, 13) = "金额"
- Cells(2, 14) = "组三注数"
- Cells(2, 15) = "金额"
- Cells(2, 16) = "组六注数"
- Cells(2, 17) = "金额"
- cz = k3dshijihao: czmc = d3s
- With ActiveSheet.QueryTables.Add(Connection:= _
- "TEXT;" & cz, Destination:=Range("A3"))
- .Name = czmc
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = True
- .RefreshOnFileOpen = False
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = False
- .SaveData = True
- .AdjustColumnWidth = True
- .RefreshPeriod = 0
- .TextFilePromptOnRefresh = False
- .TextFilePlatform = xlWindows
- .TextFileStartRow = 1
- .TextFileParseType = xlDelimited
- .TextFileTextQualifier = xlTextQualifierDoubleQuote
- .TextFileConsecutiveDelimiter = True
- .TextFileTabDelimiter = False
- .TextFileSemicolonDelimiter = False
- .TextFileCommaDelimiter = False
- .TextFileSpaceDelimiter = True
- .TextFileColumnDataTypes = Array(1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
- .TextFileTrailingMinusNumbers = True
- .Refresh BackgroundQuery:=False
- End With
- Range("Z3:AP8000").Clear
- k3dshijihao = "http://www.17500.cn/getData/p5.TXT"
- d3s = "WData3D_All"
- Cells(2, 1) = "开奖期号"
- Cells(2, 2) = "开奖日期"
- Cells(2, 3) = "开"
- Cells(2, 4) = "奖"
- Cells(2, 5) = "号"
- Cells(2, 6) = " "
- Cells(2, 7) = " "
- Cells(2, 8) = "投注总额"
- Cells(2, 9) = "中奖注数"
- Cells(2, 10) = "单注奖金"
- cz = k3dshijihao: czmc = d3s
- With ActiveSheet.QueryTables.Add(Connection:= _
- "TEXT;" & cz, Destination:=Range("Z3"))
- .Name = czmc
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = True
- .RefreshOnFileOpen = False
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = False
- .SaveData = True
- .AdjustColumnWidth = True
- .RefreshPeriod = 0
- .TextFilePromptOnRefresh = False
- .TextFilePlatform = xlWindows
- .TextFileStartRow = 1
- .TextFileParseType = xlDelimited
- .TextFileTextQualifier = xlTextQualifierDoubleQuote
- .TextFileConsecutiveDelimiter = True
- .TextFileTabDelimiter = False
- .TextFileSemicolonDelimiter = False
- .TextFileCommaDelimiter = False
- .TextFileSpaceDelimiter = True
- .TextFileColumnDataTypes = Array(1, 2, 1, 1, 1, 1, 1, 1, 1, 1)
- .TextFileTrailingMinusNumbers = True
- .Refresh BackgroundQuery:=False
- End With
- End Sub
复制代码
|
|