Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.excel.programming > #110107
| Newsgroups | microsoft.public.excel.programming |
|---|---|
| Date | 2017-07-10 06:03 -0700 |
| Message-ID | <e7e4d43a-d577-4e52-a894-aaa91d573168@googlegroups.com> (permalink) |
| Subject | Login to intranet and download excel file using vba |
| From | chandrabd.shah@gmail.com |
Hi,
I have company wiki which contains some attachment in it. So first I need to login to the wiki and then download the excel file.
I have tried this:
Dim strValue As String
Dim myValue As Variant
Dim myHTMLElement As IHTMLElement
Dim myHTMLElement1 As IHTMLElement
strValue = "http://...wiki/"
On Error GoTo err_clear
myBrowser.Visible = True
myBrowser.navigate strValue
Do
DoEvents
Loop Until myBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = myBrowser.document
' Load all the details to the login page
HTMLDoc.all.Item("os_username").Value = "username"
myValue = InputBox("Password for your account:")
If myValue = "" Then Application.Quit
HTMLDoc.all.Item("os_password").Value = myValue
'Finds the login button and proceeds the click event
For Each myHTMLElement In HTMLDoc.getElementsByTagName("input")
If myHTMLElement.ID = "loginButton" Then
myHTMLElement.Click
Do While myBrowser.Busy: DoEvents: Loop
Do Until myBrowser.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Workbooks.Open ("http://...wiki/download/List.xls")
Exit For
End If
Next
err_clear:
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
Exit Sub
End If
When I run the above code it just copies the login page my excel sheet.
Could anyone suggest me what should be done?
Thanks
Back to microsoft.public.excel.programming | Previous | Next — Next in thread | Find similar | Unroll thread
Login to intranet and download excel file using vba chandrabd.shah@gmail.com - 2017-07-10 06:03 -0700
Re: Login to intranet and download excel file using vba GS <gs@v.invalid> - 2017-07-10 15:02 -0400
Re: Login to intranet and download excel file using vba chandrabd.shah@gmail.com - 2017-07-11 03:18 -0700
Re: Login to intranet and download excel file using vba GS <gs@v.invalid> - 2017-07-11 10:34 -0400
csiph-web