Running a web query when there is a user name and password

rca

Board Regular
Joined
Mar 1, 2005
Messages
182
Hi Everyone!

I'm trying to run a web query from a website that requires a user name and password.

Is it possible to do such a thing when the website has a user name and password?

Thank you,
Rachel :biggrin:
 
Joe.

I could not find any method or property in SHDocVw that would allow the user to directly maximize the window.

msvec

If you cannot find a way to do this, use the API. It will work for sure.


See this link for more constants you may use with the ShowWindow API function.

<table border="1" bgcolor="White"><caption ALIGN=left><font size="2" face=Courier New>Example VBA Code:</FONT></caption><tr><td><font size="2" face=Courier New>  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> ShowWindow <font color="#0000A0">Lib</font> "user32" ( _
       <font color="#0000A0">ByVal</font> hwnd <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> nCmdShow <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  
  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> SW_MAXIMIZE = 3
  
  <font color="#0000A0">Sub</font> Example()
       <font color="#0000A0">Dim</font> ie <font color="#0000A0">As</font> <font color="#0000A0">Object</font>
      
       <font color="#0000A0">Set</font> ie = CreateObject("InternetExplorer.Application")
       ie.Visible = True
      
       ShowWindow ie.hwnd, SW_MAXIMIZE
  
  <font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
</FONT></td></tr></table>

Tom
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I did not check the WindowState code with Web Open, which works on other windows, if the application opens in its own window.

But do know that this works:


Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
'Standard module code, like: Module1.
'Maximize opened window!

Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2

Sub myMrExcel()
'Standard module code, like: Module1.
'Open Mr Excel in Explorer window.
Dim ie As Object

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "http://www.MrExcel.com"
Do
If ie.readystate = 4 Then
ie.Visible = False
Exit Do
Else
DoEvents
End If
Loop

'Maximize opened window!
apiShowWindow ie.hwnd, SW_MAXIMIZE

'MsgBox "Done"
ie.Visible = True

End Sub


Edit; P. S: Just checked the code below with a web open and you are right it does not work with a web open:

Application.Wait (Now + TimeValue("0:00:02"))
ActiveWindow.WindowState = xlMaximized

But, the API call in the code above the failed code, for the WindowState, does work!
 
Upvote 0
Thank you for the useful posts here,

I used the same approach to login a page, but then i my page, I got an HTML page with 2 frames, the right hand side page is the one I need to extract data from.

But I don't know how I could reach to the content of that page.

Any hint?

Thanks
Hung
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,395
Members
449,446
Latest member
CodeCybear

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top