Define Unique Instance of IE (1 Viewer)

abbaddon223

Registered User.
Local time
Yesterday, 20:21
Joined
Mar 13, 2010
Messages
161
Hi Experts....

I'm using the below code to generate an instance of IE to make a call via a VoIP system - works fine.

The issue I am having comes with firing multiple instance of the code in quick sucsession. So, execute the proceedure, then loop. Again I can do the loop bit fine.

Where I'm struggling (I think) is when it tries to close the instance of IE, then open a new instance of IE it's getting upset (seems okay if I don't ie.quit)

What I THINK I need to do is define a unique instance of IE that can be closed, whilst moving into a new instance of IE.

What I had in mind was using a control [ID] in a form which will always have a URN in it. So something like

Dim IE as New InternetExploer
Dim Ref as string
Ref = [ID]

Then open an instance of Ie contatinated with the Ref string so that when I go to close the instance of IE, it's the unique one.

IeRef.quit (wouldn't work I appreciate)

Anyway, my prattle over and code below.

Any assistance is greatly appreciated.....:banghead:


Dim Ext As String
Ext = "001"
Dim Acc As String
Acc = "SOMENAME"
Dim Password As String
Password = "PASSWORD"

Dim Ie As New InternetExplorer
Dim htmldoc As HTMLDocument
Dim number As String
Dim res As String
Dim contact_name As String
Dim agent As String
Dim extension As String
Dim url As String
Dim acct, pass As String

extension = Ext
acct = Acc
pass = Password



number = Replace(Me.Phone_Number, " ", "")
number = Replace(number, "-", "")
contact_name = "X"
url = "https://DOMAIN/SOMEAPI/ETC/Call/MakeCall?" + _
"Account=" & acct & _
"&PassPlain=" & pass & _
"&ExtensionAccount=0000*" + extension + _
"&FromNumber[]=0000*" + extension + _
"&PhoneNumberToCall=" + number + _
"&CallerIDName=" + contact_name + _
"&CallerIDNumber=" + number


Ie.Visible = false
Ie.navigate url
Do
DoEvents
Loop Until Ie.ReadyState = READYSTATE_COMPLETE
Set htmldoc = Ie.Document
'IE.Quit
[Completed] = "Yes"
[CompletedDate] = Now()
DoCmd.GoToRecord acDataForm, "Frm_Numbers"
 

Users who are viewing this thread

Top Bottom