cancel
Showing results for 
Search instead for 
Did you mean: 

SAPGui Scripting from VBA

Former Member
0 Kudos

Hi,

I am creating a macro in Excel which would load asset data through SAPGui Scripting but I am running into a very strange problem.

In order to be sure that the data get's loaded to correct system I have created inputbox where all the open systems are listed and the user should select one by entering a corresponding number. (it's the number of connection object in Application.Connections collection) When this number is used as a variable in

Set App = SapGuiAuto.GetScriptingEngine

...

Dim I

I = InputBox(ItemText, "Select open system", 0)

Set Connection = App.Children(I)

Then the system returns following message:

Run time error '618'

Bad index type for collection access

Anybody has any ideas what might be wrong?

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Peeter Parelo:

Please try the following:

...

'Dim I

I = InputBox(ItemText, "Select open system", 0)

Set Connection = App.Children(int(I))

...

end sub