Hello everyone,
I wonder if anyone could help me at all
I am trying to extract data from a Java program called WCC which is similar to AS/400 for those who are familiar with it.
The Macro is up and running and works perfectly.
The only issue I have is when entering the wrong value in the input box (wrong session ID), instead of sending back an error message Excel will stop working and not responding
Here is a copy of the VBA code:
Sub main(start_line)
Set Session1 = CreateObject("PCOMM.autECLSession")
Lookup = InputBox("Please enter your session ID", "Session ID")
Session1.setconnectionbyname Lookup
If Lookup = False Then
MsgBox "Wrong Session ID! Try again!"
'Stop running the macro
Exit Sub
End If
Set insheet = Sheets("InputSheet")
'read the number of accounts in the list'
Set myrange = insheet.Range("b3:b65002")
accounts = 65000 - Application.WorksheetFunction.CountBlank(myrange)
Call TKeys(Session1, "[Home][Erase EOF]WCADV[Enter]") 'go to screen WCADV'
For account_loop = start_line To accounts + 2 'loop through acounts on list'
insheet.Cells(1, 1) = (accounts + 3) - account_loop 'update countdown'
account_text = insheet.Cells(account_loop, 2).Text 'get account number from list'
Call FindWCCData(Session1, account_text)
Call WriteWCCData(insheet, account_loop)
Next account_loop
insheet.Cells(1, 1) = ""
End Sub
I know that IF Lookup = False needs amending or completely rewriting, so that each time the session entered on the box is not actually opened or cannot be found then it woul automatically send a message back asking to enter another session ID instead of just lagging and myself having to restart Excel all over again.
I am nearly there but some help would be rally appreciated. I am still only a novice when it comes to create macros so please help
Thank you very much
Bookmarks