Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

VBA code for skipping microsoft excel security warning

$
0
0

When I do import data from website,which is trusted still I get warning message from Excel as shown in below picture.

I have tried installing this certificated several time, but it didn't help me with this.

SO what I want is, automatically click on yes, when so ever this warning message appears.

Code to import data

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 = 900
        .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

Kindly please help with this issue.

Warning message


Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>