Comment Refresh Requête Web Excel toutes les 10 sec ?
l
Bonjour à tous,
Quelqu'un sait-il comment modifier une requête web pour qu'elle s'actualise automatiquement toutes les 10 secondes, car Excel propose au minimum 1 minute ?
Merci
Laurent
Bonsoir,
Pendant la réactualisation la page Web, que fais-tu
Cependant, je joints un fichier avec macro pour des cours de change. La mise à jour est à 5minutes, mais tu peux la modifier à ton gré...
.RefreshPeriod = 5Cdlt.
Option Explicit
Sub TauxDeChange() '
' TauxDeChange Macro
' Touche de raccourci du clavier: Ctrl+q
Dim sH As Worksheet
Dim Plage As Range
Dim derLigne As Byte, derColonne As Byte
Application.ScreenUpdating = False
On Error Resume Next
DeleteAllQueries
On Error GoTo 0
Set sH = Worksheets("Taux Devises")
With sH
.Cells.Delete
With .Cells.Font
.Name = "Arial"
.Size = 9
.Color = -10477568
End With
With [A1]
.Value = "Tableau de taux de change Forex"
.Font.Size = 10
.Font.Bold = True
End With
With [A2]
.Value = Format(Now(), "ddd dd mmm yyyy - hh:mm")
.Font.Color = -11489280
.Font.Size = 8
End With
End With
With sH.QueryTables.Add(Connection:= _
"URL;http://www.forexpros.fr/quotes/tableau-de-taux-de-change", Destination:=Cells(4, 1))
.Name = "Tableau-de-taux-de-change-Forex"
.FieldNames = True
'.RowNumbers = False
'.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
'.SavePassword = False
'.SaveData = False
.AdjustColumnWidth = True
.RefreshPeriod = 5
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = """exchange_rates_1"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = True
'.WebDisableDateRecognition = False
'.WebDisableRedirections = False
.Refresh BackgroundQuery:=True
End With
With sH
derLigne = .Range("A" & Rows.Count).End(xlUp).Row
derColonne = .Cells(4, Cells.Columns.Count).End(xlToLeft).Column
Set Plage = .Range(Cells(5, 2), Cells(derLigne, derColonne))
With Plage
.Replace What:=".", Replacement:=".", LookAt:=xlPart, _
SearchOrder:=xlByRows
.NumberFormat = ("0.0000")
.Columns.AutoFit
End With
End With
Set sH = Nothing: Set Plage = Nothing
End Sub
Private Sub DeleteAllQueries()
Dim qt As QueryTable
Dim sH As Worksheet
For Each sH In ThisWorkbook.Worksheets
For Each qt In sH.QueryTables
qt.Delete
Next qt
Next sH
End Sub