Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Open Browser Maximized

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("MyWorkshee t").Range("MyUsername").Value
= "" Or
Workbooks("MyWorkbook.xls").Worksheets("MyWorkshee t").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("MyWorkshee t").Range("MyUsername").Value
Set ipf = ie.document.all.Item("Password")
ipf.Value =
Workbooks("MyWorkbook.xls").Worksheets("MyWorkshee t").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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Open Browser Maximized

You can do that with the ShowWindow API:

Option Explicit
Private Declare Function ShowWindow _
Lib "user32" _
(ByVal hwnd As Long, _
ByVal nCmdShow As Long) _
As Long

Sub ShowIEMaximized()

Dim oIE As Object

Set oIE = CreateObject("InternetExplorer.Application")

oIE.Navigate "http://www.google.co.uk/"

ShowWindow oIE.hwnd, 3

End Sub


RBS


"Stephen Newman" wrote in message
...
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("MyWorkshee t").Range("MyUsername").Value
= "" Or
Workbooks("MyWorkbook.xls").Worksheets("MyWorkshee t").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("MyWorkshee t").Range("MyUsername").Value
Set ipf = ie.document.all.Item("Password")
ipf.Value =
Workbooks("MyWorkbook.xls").Worksheets("MyWorkshee t").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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Open Browser Maximized

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" wrote in message
...
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("MyWorkshee t").Range("MyUsername").Value
= "" Or
Workbooks("MyWorkbook.xls").Worksheets("MyWorkshee t").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("MyWorkshee t").Range("MyUsername").Value
Set ipf = ie.document.all.Item("Password")
ipf.Value =
Workbooks("MyWorkbook.xls").Worksheets("MyWorkshee t").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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Open Browser Maximized

Thanks so much RB. Exactly what I was looking for. Worked perfectly.

On Sat, 15 Apr 2006 15:25:48 +0100, "RB Smissaert"
wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Open Browser Maximized

No trouble.
If you don't have it yet download this:
http://www.allapi.net/agnet/apiguide.shtml
Helps me out all the time.

RBS

"Stephen Newman" wrote in message
...
Thanks so much RB. Exactly what I was looking for. Worked perfectly.

On Sat, 15 Apr 2006 15:25:48 +0100, "RB Smissaert"
wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want Word & Excel to open maximized. highbloodpressure Excel Discussion (Misc queries) 1 November 7th 08 08:29 PM
Open Excel not in a browser JS82 Excel Discussion (Misc queries) 1 March 30th 07 02:42 PM
excel can not open on some IE browser Faiz Excel Discussion (Misc queries) 3 July 20th 06 01:29 PM
File Open Box Suddenly Maximized ChelseaWarren Excel Worksheet Functions 2 February 10th 06 12:16 AM
How do I get excel to always open with a maximized window Stacymm Excel Discussion (Misc queries) 1 February 10th 05 10:07 PM


All times are GMT +1. The time now is 01:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"