Hi,
I am attempting to fill in an online form in internet explorer, my code fills in the blank input text boxes on the form and then I would like a userform ('DWGRegCheck_Submit') to appear prompting the user to select options from the dropdown menu (hence the userform is non-modal) as it has proven too much of a hassle to achieve this through code. Once selecting the options the user should then be able to click a CommandButton (named 'DWGSubmit_Button') on the userform, and the code will continue and click 'submit' on the webpage etc. etc.
Heres my attempt so far:
IN DWGRegCheck_Submit (Code):
Private Sub Cancel_Button_Click()
CancelClick = True
End Sub
Sub DWGSubmit_Button_Click()
DWGSubClick = True
End Sub
IN Module 1:
Public DWGSubClick As Boolean
Public CancelClick As Boolean
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Sub FillInForm()
Set ie = CreateObject("InternetExplorer.application")
ie.Visible = True
SetParent ie.hwnd, Application.hwnd
ie.navigate (URL)
'fill in text boxes online
DWGRegCheck_Submit.Show
Do Until DWGSubClick = True 'This loop code causes excel to crash and the 'click' does not seem to register on the CommandButton
If CancelClick = True Then GoTo 1
Loop
DWGSubClick = False
DWGRegCheck_Submit.Hide
'further code
1
End Sub
The problem I have is when I run the code excel crashes on the Do loop (However it cycles through when pressing F8)
The 'DWGSubmit_Button' and 'Cancel_Button' do not seem to fire properly as I have left a breakpoint on the lines 'DWGSubClick = True' and 'CancelClick = True' and the code does not pause there
Bookmarks