小编use*_*101的帖子

Excel VBA,我在访问URL时得到提示"Windows安全性"

我有一个访问URL HTTPS的Excel文件.URL作为基本身份验证,包含用户名和密码.

这个宏每天早晚都在运行.它需要它是AUTOMATIC.我有用户名和密码.

问题是,每次运行宏时,都会提示我"Windows安全性".用户名和密码已经填满,因为我确实在我的凭据中添加了此连接."windows安全性"只是等待用户单击"输入".此宏应自动运行,不能等待某人单击确定.

我确实尝试使用VBS Script登录,但只有当用户在会话中处于活动状态时才会起作用.请参阅:VBA代码以传递用户名和密码

我也尝试将用户名和密码放在URL中,如:...

如何连接没有"Windows安全"提示???

这里我的添加连接功能:

Function GetForcast(DateStart As String, DateEnd As String)


    Sheets("Forecast RAW").Select
    With Sheets("Forecast RAW").QueryTables.Add(Connection:= _
        "URL;https://weather.dtn.com/basic/rest-3.4/obsfcst.wsgi?dataTypeMode=0001&dataType=HourlyForecast&startDate='" & DateStart & "'T00:00:00Z&EndDate='" & DateEnd & "'T00:00:00Z&stationID=KILG" _
        , Destination:=range("$A$1"))
        .Name = "00Z&stationID=KILG"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = True
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlEntirePage
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

5
推荐指数
1
解决办法
2840
查看次数

标签 统计

excel ×1

excel-vba ×1

vba ×1