Close Browser window with VBA

  • Thread starter Thread starter brianelson
  • Start date Start date
B

brianelson

I have the following code that sends a message to a web
page and tehn to a pager. bypassing the outlook object
model gaurd BUT it opens a new web page window. and I
want to close the windows after it is done sending.

Sub sendtopagers()
txtMessage = "Test"
PagerNumber = "2081234567"
fulltest = "PIN=" & PagerNumber & "&MSSG=" & txtMessage
& "&Q1=0"

ThisWorkbook.FollowHyperlink "http://www.Arch.com/cgi-
bin/wwwpage.exe", , True, , fulltest, msoMethodPost


Any Help would be apprecieated

Brian Elson
 
Hi Brianelson,

I don't know if I understood your question, but I think you have to handle
the IE as object with a code like this rough:

' =======Start Code=======
Dim IEObj As Object

Sub Test()
OpenIE "http://example.microsoft.com"
IEObj.Quit
Set IEObj = Nothing
End Sub

Public Sub OpenIE(vURL As String)
On Error GoTo ErrorHandler
IEObj.Visible = True
With IEObj
.Visible = True
.Navigate vURL
Do Until Not .Busy
DoEvents
Loop
End With
Exit Sub
ErrorHandler:
Set IEObj = Nothing
Set IEObj = CreateObject("InternetExplorer.Application")
Resume Next
End Sub
'======End Code========
 
Back
Top