Macro to OK Windows Security

edwardj3

New Member
Joined
Jan 16, 2018
Messages
41
Office Version
  1. 365
Platform
  1. Windows
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.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,224,826
Messages
6,181,192
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top