Morning all,
Got a macro which imports tables from internal web pages. I currently have to 'OK' when the Windows Security alert appears. The pop-up states that the server xxxxx is asking for your username and password. These details are already populated and stored from previous entry so I just click OK and the remaining code runs to completion. Is it possible to automatically select OK when the pop-up appears.
I've found a reference to SendKeys and there may be a need to wait but this does not resolve my issue. Code extract below
ActiveWorkbook.Worksheets.Add
ActiveSheet.Name = fmtToday_a
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://" & fmtToday, _
Destination:=Range("$A$1"))
.Name = fmtToday
.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 'this is where the code is highlighted when I do not press OK and debug
End With
Application.Wait (Now() + TimeValue("00:00:05"))
SendKeys ("{ENTER}")
Any advice you can provide would be really appreciated as I'm looking to auto-run the macro through the night so it is available when we get into work to issue. Using Windows 7 and Excel 2007.
Got a macro which imports tables from internal web pages. I currently have to 'OK' when the Windows Security alert appears. The pop-up states that the server xxxxx is asking for your username and password. These details are already populated and stored from previous entry so I just click OK and the remaining code runs to completion. Is it possible to automatically select OK when the pop-up appears.
I've found a reference to SendKeys and there may be a need to wait but this does not resolve my issue. Code extract below
ActiveWorkbook.Worksheets.Add
ActiveSheet.Name = fmtToday_a
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://" & fmtToday, _
Destination:=Range("$A$1"))
.Name = fmtToday
.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 'this is where the code is highlighted when I do not press OK and debug
End With
Application.Wait (Now() + TimeValue("00:00:05"))
SendKeys ("{ENTER}")
Any advice you can provide would be really appreciated as I'm looking to auto-run the macro through the night so it is available when we get into work to issue. Using Windows 7 and Excel 2007.