首页 > 解决方案 > 跳过安全警告

问题描述

我从受信任的网站导入数据。我收到来自 Excel 的警告消息。

警告信息

我多次尝试安装此证书。

我想要的是,当出现此警告消息时,自动单击是。

导入数据的代码

Sub OPTIONSPULL()

For X = 1 To 7
    Worksheets("OPTIONS").Select
    Worksheets("OPTIONS").Activate

    MYSTR = "URL;https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?segmentLink=17&instrument=OPTIDX&symbol=NIFTY&date=14NOV2019"
    MYSTR = Cells(X, 1)

    Dim STR As String, I As Integer

    For I = X To X
        STR = Cells(I, 2).Value
    Next I

    Worksheets.Add(after:=Worksheets(Worksheets.Count)).Name = STR

    With ActiveSheet.QueryTables.Add(Connection:= _
        MYSTR, Destination:=Range("$A$1"))
        .Name = "optionKeys.jsp?segmentLink=17&instrument=OPTIDX&symbol=NIFTY&date=14NOV2019"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = False
        .RefreshPeriod = 15
        .WebSelectionType = xlEntirePage
        .WebFormatting = xlWebFormattingRTF
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = True
        .WebDisableRedirections = True
        .Refresh BackgroundQuery:=False
    End With
Next X

Worksheets("OPTIONS").Select

End Sub

标签: excelvba

解决方案


推荐阅读