walkingseed
Technical User
I have a program that has report templates that are stored in XML format. The CDATA section has VBSCRIPT contained within it. I need to be able to insert data into the report dynamically at execution time. What I need to be able to do is pause execution of the script without pinning the CPU until the Internet Explorer Application closes. I tried instantiating the InternetExplorer object using Wscript.CreateObject("InternetExplorer.Application", "IE_")
so that I can trap events. but I get and Error 5800 Object Required error. I figure if I can trap events I can launch a shell using the Object.Run method, halting the script, which effectively emulates the DoEvents. When I close the IE object I should then be able to detect that event and close the shell thereby resuming the script. I need to detect the termination of IE so that I can pull data from htm before it is closed.
Is it possible to do event detection without Wscript?
Can I pull the data from the Internet Explorer form when using the Object.Run method? This would work too if it is possible but I haven't been able to figure out how.
'Do some stuff to create a new htm file form
' Launch Internet Explorer, and connect event handler.
Set objIntExplorer = CreateObject("InternetExplorer.Application")
' Format the Internet Explorer Form
objIntExplorer.Left = 50 ' Window position and other properties
objIntExplorer.Top = 100
objIntExplorer.Height = 500
objIntExplorer.Width = 600
objIntExplorer.MenuBar = 0 ' No menu
objIntExplorer.ToolBar = 0
objIntExplorer.StatusBar = 0
objIntExplorer.navigate "C:\PipTrackerStds\PipStds.htm" ' Load form.
objIntExplorer.Visible = 1 ' Keep visible.
' Wait until Internet Explorer is ready.
Set cmdShell = CreateObject("Wscript.Shell")
cmdShell.Run "cmd", 2, True
'Trash Collection
Set cmdShell = Nothing
Set objExplorer = Nothing
'Detect the Quit Event on the IE object
Sub IE_Quit()
'Do the reporting stuff
'...
'Deleted reporting code
'...
cmdShell.AppActivate("cmd.exe")
cmdShell.SendKeys("exit~")
End Sub
so that I can trap events. but I get and Error 5800 Object Required error. I figure if I can trap events I can launch a shell using the Object.Run method, halting the script, which effectively emulates the DoEvents. When I close the IE object I should then be able to detect that event and close the shell thereby resuming the script. I need to detect the termination of IE so that I can pull data from htm before it is closed.
Is it possible to do event detection without Wscript?
Can I pull the data from the Internet Explorer form when using the Object.Run method? This would work too if it is possible but I haven't been able to figure out how.
'Do some stuff to create a new htm file form
' Launch Internet Explorer, and connect event handler.
Set objIntExplorer = CreateObject("InternetExplorer.Application")
' Format the Internet Explorer Form
objIntExplorer.Left = 50 ' Window position and other properties
objIntExplorer.Top = 100
objIntExplorer.Height = 500
objIntExplorer.Width = 600
objIntExplorer.MenuBar = 0 ' No menu
objIntExplorer.ToolBar = 0
objIntExplorer.StatusBar = 0
objIntExplorer.navigate "C:\PipTrackerStds\PipStds.htm" ' Load form.
objIntExplorer.Visible = 1 ' Keep visible.
' Wait until Internet Explorer is ready.
Set cmdShell = CreateObject("Wscript.Shell")
cmdShell.Run "cmd", 2, True
'Trash Collection
Set cmdShell = Nothing
Set objExplorer = Nothing
'Detect the Quit Event on the IE object
Sub IE_Quit()
'Do the reporting stuff
'...
'Deleted reporting code
'...
cmdShell.AppActivate("cmd.exe")
cmdShell.SendKeys("exit~")
End Sub