我需要在一个Excel工作簿中单击一个按钮,然后从网站自动打开另一个工作簿,并从此工作簿中打印选定的单元格。
到目前为止,我的代码为我打开了网站的工作簿,但是我需要包含打印选定单元格的部分。 提前谢谢!
这是我的代码:
Sub Project4000()
'open IE, navigate to the desired page and loop until fully loaded
Set IE = CreateObject("InternetExplorer.Application")
my_url = "Link to the file in the website"
With IE
.Visible = True
.Navigate my_url
.Top = 50
.Left = 530
.Height = 400
.Width = 400
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
End With
' Input the userid and password
IE.Document.getElementById("uid").Value = "user"
IE.Document.getElementById("password").Value = "passw"
' Click the "Search" button
IE.Document.getElementById("enter").Click
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
End Sub