我目前正在做文件上传的自动化
下面是输入文件标签的 HTML 标签:
<input name="file" title="Type the path of the file or click the Browse button to find the file." id="file" type="file" size="20">
下面是按钮 HTML 标签:
<input name="Attach" title="Attach File (New Window)" class="btn" id="Attach" onclick="javascript:setLastMousePosition(event); window.openPopup('/widg/uploadwaiting.jsp', 'uploadWaiting', 400, 130, 'width=400,height=130,resizable=no,toolbar=no,status=no,scrollbars=no,menubar=no,directories=no,location=no,dependant=no', true);" type="submit" value="Attach File">
我的VBA编码是:
Dim filee As Object
Set filee = mydoc.getElementById("file")
filee.Value = filenamepath
Set attach = mydoc.getElementsByName("Attach")
attach(0).Click
当我运行此编码时,输入文件路径框未分配路径名,因此我选择了文件路径。
Find attach screenshot.
最后我尝试了下面的代码,但是发送键没有执行
Dim filee As Object
Set filee = mydoc.getElementById("file")
filee.Click
obj.SetText filename
obj.PutInClipboard
SendKeys "^v"
SendKeys "{ENTER}"
Set attach = mydoc.getElementsByName("Attach")
attach(0).Click
Set finall = mydoc.getElementsByName("cancel")
finall(0).Click
请告诉我 Windows API 程序来分配我的文件名目录好名字:输入框打开选择要打开的文件资源管理器并单击open按钮。