fluffynicesheep
Board Regular
- Joined
- Oct 27, 2009
- Messages
- 69
Hi,
I currently have a code that runs when I open a workbook that simply refreshes all external data links, sorts information into order, saves and closes.
A couple of different websites that I'm linked to have issues with certificates, and a popup appears halfway through the refresh all, that says "Microsoft Excel Security Warning - The name on the Security Certificate is invalid or does not match the name of the site". It then asks if you want to proceed and gives the options of [Yes], [No] and [View Certificate].
I would like the VBA to automatically answer [YES] to this question, whenever it's asked and to continue running - so it reaches the end and closes without me having to press [enter]/
If someone could let me know what I need to add to this code, to either bypass the popup completely each time it displays, or to automatically select [yes] and click [enter] when asked that would be great.
Thanks
I currently have a code that runs when I open a workbook that simply refreshes all external data links, sorts information into order, saves and closes.
A couple of different websites that I'm linked to have issues with certificates, and a popup appears halfway through the refresh all, that says "Microsoft Excel Security Warning - The name on the Security Certificate is invalid or does not match the name of the site". It then asks if you want to proceed and gives the options of [Yes], [No] and [View Certificate].
I would like the VBA to automatically answer [YES] to this question, whenever it's asked and to continue running - so it reaches the end and closes without me having to press [enter]/
If someone could let me know what I need to add to this code, to either bypass the popup completely each time it displays, or to automatically select [yes] and click [enter] when asked that would be great.
Thanks
VBA Code:
Private Sub Workbook_Activate()
ActiveWorkbook.RefreshAll
DoEvents
Application.DisplayAlerts = False
Dim ws As Worksheet, t As ListObject
On Error Resume Next
For Each ws In Sheets
For Each t In ws.ListObjects
t.Range.Sort key1:=t.Name & "[DATE]", Order1:=xlDescending
Next
Next
ThisWorkbook.Save
Application.DisplayAlerts = True
Application.Quit
End Sub