Get external data by dynamical url -> no update

D

drofluga

Hi there,

i have a problem to update my external data. I read a URL from the
Field B5 and then i try to connect to this URL and read my datas but
Excel doesnt update this data when i change the URL. I guess this
problem is related to the "import data" dialog in Excel, but i'm not
sure.

here is my code:


'Read the current URL
Sheets("Sheet1").Select
Dim zelle
zelle = "B5"
Dim wert
wert = Range(zelle).value

'update sheet
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & wert & "" _
, Destination:=Range("A1"))
.Name = "AlertUser"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = _
"""Header_g_a134c740_e525_4177_bdd8_e384ed89782d_alertstable"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With


I hope that anyone can help me.

Best Regards

Julian
 
R

R..VENKATARAMAN

can you not try an event code like
worksheet_change.
so that if the target value is changed the corresponding url is opened.
 
D

drofluga

Thanks for you idea, but the URL is always correct. Excel only doesnt
put the data into the sheet when i change the url.

regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top