I am trying to call OLEObject.ExecWB() following the Internet Explorer automation method described at
The VB code I am trying to translate is :
intZoomLevel = 100
Const OLECMDID_OPTICAL_ZOOM = 63
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
While objIE.Busy = True
objIE.ExecWB OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, CLng(intZoomLevel), vbNull
It is meant to change the optical zoom by code.
What I am doing is this :
Dim obj as OLEObject Dim v as Variant Dim params(1) as Variant obj = New OLEObject("InternetExplorer.Application", True) obj.Value("Visible") = True params(1) = "http://www.wikipedia.org/" v = obj.invoke("Navigate", params) // Wait 1 second for IE to be finished loading. // Will change it through DocumentComplete when it works... dim oldmicro as double = microseconds while microseconds-oldmicro < 10000000 wend // Change zoom level to 200% dim intZoomLevel as variant= 200 dim OLECMDID_OPTICAL_ZOOM as int32 = 63 //OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER is enum value = 2 v = obj.ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,intZoomLevel,nil) Exception err as OLEException MsgBox err.message
Following the directions of parameters call in the execWB method description, the first parameter is a VB Long, which I set as Int32. The second one is a VB Enum, which I have set as :
Public Enum OLECMDEXECOPT
OLECMDEXECOPT_DODEFAULT = 0
OLECMDEXECOPT_PROMPTUSER = 1
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_SHOWHELP = 3
The last two parameters in the VB code ExecWB call are a variant intZoomLevel and nil in this instance.
From what I can figure the call is the replica of the VB code translated to Xojo. Yet I am getting an OLE Exception error: Exception, (failed on “ExecWB”), Error number -2147352567. Looked for error code 2147352567 and all it says it that an exception occured. Not much help
It is not IE is still busy. I tried longer delay to no avail.
What is wrong ?
I will strongly appreciate any help.