tjarodri
17-04-2014 13:50:37
Pessoal, preciso de uma ajuda. gravei a seguinte rotina para atualizar os dados importando as informações da web. Porém estou com um problema, pois a URL não é fixa, a pesquisa é baseada entre datas.
Gostaria de saber se é possível que a macro busque o endereço da URL em uma determinada Range. Ex.With ActiveSheet.QueryTables.Add(Connection:=Range("$B2$"), _
Abaixo segue a macro que gravei.
Sub Conexao_Dados()
'
' Conexao_Dados Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://www.wblt.ccms.empresa.com/cgi-b ... monitor.pl", _
Destination:=Range("$A$1"))
.Name = "monitor.pl"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Gostaria de saber se é possível que a macro busque o endereço da URL em uma determinada Range. Ex.With ActiveSheet.QueryTables.Add(Connection:=Range("$B2$"), _
Abaixo segue a macro que gravei.
Sub Conexao_Dados()
'
' Conexao_Dados Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://www.wblt.ccms.empresa.com/cgi-b ... monitor.pl", _
Destination:=Range("$A$1"))
.Name = "monitor.pl"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub