Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 手柄对话框_Html_Vba_Internet Explorer - Fatal编程技术网

Html 手柄对话框

Html 手柄对话框,html,vba,internet-explorer,Html,Vba,Internet Explorer,我是来寻求帮助的,因为我正在尝试自动连接到一个站点以上载excel文件 我能够连接到站点,验证自己,并访问请求的文件夹。我的问题是,当我触发单击时,一个对话框窗口要求我选择文件 1-如何在对话框的地址栏中插入包含该文件的文件夹的链接并选择该文件? 2-单击“打开”按钮以附加文件 你能帮我吗? 多谢各位 注意:我指定是单击打开对话框窗口,所以我需要一个代码来与这个对话框交互 尝试SendKeys我尝试了各种方法使用VBA IE Automation在文件上载控件中设置文件,但看起来我们无法使用V

我是来寻求帮助的,因为我正在尝试自动连接到一个站点以上载excel文件

我能够连接到站点,验证自己,并访问请求的文件夹。我的问题是,当我触发单击时,一个对话框窗口要求我选择文件

1-如何在对话框的地址栏中插入包含该文件的文件夹的链接并选择该文件? 2-单击“打开”按钮以附加文件

你能帮我吗? 多谢各位

注意:我指定是单击打开对话框窗口,所以我需要一个代码来与这个对话框交互


尝试SendKeys我尝试了各种方法使用VBA IE Automation在文件上载控件中设置文件,但看起来我们无法使用VBA自动选择文件对话框,并且出于某些安全原因,我们无法直接设置文件上载控件的值。这些都是我已经在我这边测试过的东西,谢谢你的回答。您还有其他建议吗?如果可能的话,您可以尝试检查任何可以让您与“选择文件”对话框交互的UI自动化API。选择文件后,可以继续使用VBA IE自动化代码。
Dim IE As InternetExplorer
Dim HTMLDoc As HTMLDocument

Set IE = New InternetExplorerMedium
IE.Visible=True
IE.Navigate "https://myserver.com"
While IE.Busy: DoEvents: Wend
Application.Wait Now + TimeValue("00:00:10")

Set HTMLDoc = IE.document
With HTMLDoc
.getElementById("A_username").Value = "myusername"
.getElementById("A_password").Value = "mypassword"
End With

IE.document.getElementById("login").Click
While IE.Busy: DoEvents: Wend
Application.Wait Now + TimeValue("00:00:10")
IE.Navigate "https://myserver.com/link.folder
While IE.Busy: DoEvents: Wend
Application.Wait Now + TimeValue("00:00:10")

Set HTMLDoc = IE.document
With HTMLDoc
.getElementById("name").Value ="foldername" 
End With
IE.document.getElementById("addButton").Click
While IE.Busy: DoEvents: Wend
Application.Wait Now + TimeValue("00:00:10")
IE.Navigate "https://myserver.com/link.folderfind1
IE.document.getElementById("Button").Click
While IE.Busy: DoEvents:Wend
Application.Wait Now + TimeValue("00:00:10")