Having trouble initializing Gridview object in VBA

having trouble initializing  Gridview  get error 619 control could not be found!

here is the code. I'm just starting to learn about scripting!

Private Sub Test_SAP_Click()

Dim GridView As Object
'On Error GoTo Erreur

'Erreur 614 - Session n'est pas ouverte
'Erreur 619 - Pas dans le menu principal

If Not IsObject(SapAPP) Then
   Set SapGuiAuto = GetObject("SAPGUI")
   Set SapAPP = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(SAPConn) Then
   Set SAPConn = SapAPP.Children(0)
End If
If Not IsObject(session) Then
   Set session = SAPConn.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session, "on"
   WScript.ConnectObject SapAPP, "on"
End If
session.FindById("wnd[0]").resizeWorkingPane 150, 31, False
session.FindById("wnd[0]/tbar[0]/okcd").Text = "cn53n"
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]/usr/ctxtCN_PROJN-LOW").Text = "P-2017"
session.FindById("wnd[0]/usr/ctxtCN_NETNR-LOW").Text = "1234"
session.FindById("wnd[0]/usr/ctxtCN_NETNR-LOW").CaretPosition = 7
session.FindById("wnd[0]/usr/cntlALVCONTAINER/shellcont/shell").CurrentCellColumn = "LST_ACTDT"
Set GridView = session.FindById("wnd[0]/usr/cntlALVCONTAINER/shell") ' <<<<<<<<< This line gives the error!

MsgBox "Extraction compléted OK !"

Exit Sub

The code work when I execut the script  but just has a problem with the gridview.

I want to extract the data from the script and stuff it in an access database!


Peter GrovesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Frank WhiteCommented:
Is "cntlALVCONTAINER/shell" supposed to point to a different, separate shell than "cntlALVCONTAINER/shellcont/shell" within the same ALVCONTAINER?

If not, that may be all it is and switching the last line to match the previous call to the same control should help.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Peter GrovesAuthor Commented:
I had to remake the script file 2-3 times, but fianlly got one that worked , so you were correct in assuming the
shell text was wrong!

Would you know of any good gridview tutorials or documentation describing these methods preferable with examples!

Thanks for the heads up!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.