Re: Open Browser Maximized

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



This might be a better way as it will take the default browser, which
may not be IE:

Option Explicit
Private Declare Function ShellExecute _
Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Sub ShowBrowserMaximized()

Dim strURL As String

strURL = "http://www.google.co.uk/";
ShellExecute 0, "open", strURL, vbNullString, vbNullString, 3

End Sub


RBS


"Stephen Newman" <noway@xxxxxxxxxxxx> wrote in message news:4q2v32976o7t9co2avlqioog9pvmj985rg@xxxxxxxxxx
I have a macro which opens a new browser window, selects a web site to
access my company webmail, enters the information into the username
and password fields, then proceeds to my mail. Everything works fine
except I would like the browser window to open maximized. Could
somebody please tell me how to do this. I've provided the code I use
to access my mail.

Sub WebMail()
If
Workbooks("MyWorkbook.xls").Worksheets("MyWorksheet").Range("MyUsername").Value
= "" Or
Workbooks("MyWorkbook.xls").Worksheets("MyWorksheet").Range("MyPassword").Value
= "" Then frmWebMailLogin.Show
Dim SB As clsWebLoad
Dim nCounter As Integer

Set ie = CreateObject("InternetExplorer.Application")
Set SB = New clsWebLoad

SB.Title = "WebMail Loader"
SB.Show

With ie
.Visible = False
' Go to Mail login page
.Navigate "http://MyWebmail.MyCompajy.com";

Do Until .ReadyState = 4

nCounter = nCounter + 1

SB.Progress = nCounter
If .ReadyState = 0 Then SB.Caption1 = "Opening New Browser Window
" & CStr(nCounter) & "%"
If .ReadyState = 3 Then SB.Caption1 = "Getting Web Site " &
CStr(nCounter) & "%"
If .ReadyState = 4 Then SB.Caption1 = "Operation
Complete....Accessing Your Mail"

Sleep 100

Loop

Set ipf = ie.document.all.Item("Username")
ipf.Value =
Workbooks("MyWorkbook.xls").Worksheets("MyWorksheet").Range("MyUsername").Value
Set ipf = ie.document.all.Item("Password")
ipf.Value =
Workbooks("MyWorkbook.xls").Worksheets("MyWorksheet").Range("MyPassword").Value


.Visible = True
SendKeys "~", True
EndRoutine:

SB.Finish

Set SB = Nothing
End With
StopSound
End Sub

Currently the browser opens in the previous windows state. I really
don't want to change my windows settings to open maximized because
normally I like it to open without filling the entire screen.Any help
would be appreciated. TIA.

.



Relevant Pages

  • Re: How do I open an Access Database using VB6.0
    ... Use something like a ShellExecute() API to start up the Access ... ByVal lpFile As String, ByVal lpParameters As String, _ ... close the MDB when your application is closed from the System Tray. ... it opens it then closes it when ...
    (microsoft.public.vb.database.dao)
  • Dir Browser - Cant close it
    ... My Vb application opens a browser from which to select a directory ... When the application is closed the Browser window remains open. ... Public Function BrowseFolder(szDialogTitle As String, ...
    (microsoft.public.vb.winapi)
  • Re: Find name of default browser
    ... My application currently opens a HTML file in IE but with all the recent controversy surrounding security I don't want to open IE without user consent especially if they have installed a replacement browser and set it as default. ... ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _ ...
    (microsoft.public.vb.general.discussion)
  • Re: hyperlinking
    ... But it opens up in the current window. ... > Private Sub Navigate ... > ByVal lpOperation As String, ByVal lpFile As String, ByVal ... >>and then the web browser to open to the specified web ...
    (microsoft.public.vb.general.discussion)
  • ShellExecute for a Website
    ... In D3 I have successfully used ShellExecute to open a web page in the ... ShellExecute(Application.Handle, nil, ... The browser opens but in the Address ...
    (borland.public.delphi.nativeapi)