Vous êtes sur la page 1sur 2

Public RunWhen As Double Public Const cRunIntervalSeconds = 10 Public Const cRunWhat = "The_Sub" Sub StartTimer() RunWhen = Now + TimeSerial(0,

0, cRunIntervalSeconds) Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _ schedule:=True End Sub Sub The_Sub() MsgBox "" ' ' your code here ' StartTimer End Sub Sub StopTimer() On Error Resume Next Application.OnTime earliesttime:=RunWhen, _ procedure:=cRunWhat, schedule:=False End Sub Sub Macro1() ' ' Macro1 Macro ' ' Application.Goto Reference:="Macro1" ActiveWorkbook.Save Application.Run "Book1.xlsx!Macro1" Application.Run "Book1.xlsx!StartTimer" Application.Run "Book1.xlsx!The_Sub" Range("E8").Select Application.Run "Book1.xlsx!The_Sub" With ActiveSheet.QueryTables.Add(Connection:= _ "URL;res://ieframe.dll/dnserrordiagoff_webOC.htm#https://wwww.mcxindia.c om", _ Destination:=Range("$E$8")) .Name = "wwww.mcxindia" .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 Application.Run "Book1.xlsx!The_Sub" Range("F8").Select ActiveCell.FormulaR1C1 = "" Range("E8").Select ActiveCell.FormulaR1C1 = "" Range("B8").Select Application.Run "Book1.xlsx!The_Sub" With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.mcxindia.com", _ Destination:=Range("$B$8")) .Name = "www.mcxindia" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 2 .WebSelectionType = xlSpecifiedTables .WebFormatting = xlWebFormattingNone .WebTables = "15" .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With Application.Left = -0.5 Application.Top = 84.25 Application.Run "Book1.xlsx!The_Sub" ActiveWindow.ScrollColumn = 2 ActiveWindow.ScrollColumn = 3 ActiveWindow.ScrollColumn = 2 Application.Run "Book1.xlsx!The_Sub" Application.Run "Book1.xlsx!The_Sub" ActiveWorkbook.Save Application.Run "Book1.xlsx!The_Sub" Range("E3").Select Application.WindowState = xlMinimized Application.Run "Book1.xlsx!The_Sub" Application.WindowState = xlNormal Application.Run "Book1.xlsx!The_Sub" Application.WindowState = xlMinimized Application.Run "Book1.xlsx!The_Sub" Application.WindowState = xlNormal Application.Goto Reference:="Macro1" Application.Run "Book1.xlsx!The_Sub" End Sub

Vous aimerez peut-être aussi