For the life of me, I can't figure out why the code below does not work any more. It was fine about a month ago. I haven't made any changes to MS Office nor have I changed my MDAC from the time when the code worked.
The error I get is as follows:
"property let procedure not defined and property get procedure"
My references are correct and this very same code works just fine on another machine here in the office.
Any ideas?
Randy
![[afro] [afro] [afro]](/data/assets/smilies/afro.gif)
Code:
Option Compare Database
Public oIE As SHDocVw.InternetExplorer
Public oHTML As MSHTML.HTMLDocument
Public lIEHandle As Long
Public inpFields As IHTMLElementCollection
Public txtField As HTMLTextElement
Public oField As HTMLObjectElement
Public oFrame As HTMLFrameElement
Public oRadio As HTMLOptionElement
Public oTable As HTMLTable
Public oSelect As HTMLSelectElement
Public oButton As HTMLButtonElement
Public oDiv As HTMLDivElement
Public oA As HTMLAnchorElement
Public oSpan As HTMLSpanElement
Public oImg As HTMLImg
Public oScript As HTMLScriptElement
Public IEhwnd As Long
Private Const WM_CLOSE = &H10
Private Const WM_DESTROY = &H2
Private Const WM_QUIT = &H12
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lparam As Any) As Long
Private Const WM_PASTE = &H302
Private Declare Sub sapiSleep Lib "kernel32" _
Alias "Sleep" _
(ByVal dwMilliseconds As Long)
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal _
wCmd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lparam As Long) As Long
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
-----------------------------------------------------------
Public Function NavigateIE()
Dim oLogIn As IHTMLButtonElement
Dim sAddress As String
Dim x As Long, y As Long, z As Long
On Error GoTo ErrHandler
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.navigate "[URL unfurl="true"]http://servername.com/SecuredLogin.cfm?AppName=CVBAT"[/URL]
lIEHandle = oIE.hwnd
SetForegroundWindow lIEHandle
While oIE.Busy
DoEvents
Wend
Set oHTML = oIE.Document
sSleep (1000)
LogIn
oIE.Quit
oIE.Visible = True
Exit Function
ErrHandler:
MsgBox Err.Description, , Err.Number
oIE.Quit
Exit Function
-----------------------------------------------------------
########## Error occurs in the sub below on the 'For each' line ##########
Public Sub LogIn()
Set inpFields = oHTML.all.tags("INPUT")
For Each txtField In inpFields
Select Case txtField.Name
Case "SYSM"
txtField.innerText = "jax1war"
Case "Password"
txtField.innerText = "rusty77"
Case "Submit"
txtField.Click
End Select
Next txtField
End Sub
The error I get is as follows:
"property let procedure not defined and property get procedure"
My references are correct and this very same code works just fine on another machine here in the office.
Any ideas?
Randy
![[afro] [afro] [afro]](/data/assets/smilies/afro.gif)