Further to Tom's comment in my answer above. My first answer will work with the For Each..Next approach, but I did spot a syntax error in the Next statement (see my edits to that line, above.
However, if you really don't want to use the For Each method, or it's not working for you, then you should be able to get the index approach working.
VBScript is not strongly typed, so you can't Dim variables with exact numeric types like Integer, Long or Byte. However, the Type Library that you're working with is probably expecting a strongly typed argument to the Connections method. Normally, VBScript, or the method you're calling would handle this, but you did mention that you're working with SAP (which I've automated in the past), so I'll assume that this is the cause of the problem.
Like I said, VBScript doesn't offer strongly typed declarations, but it does let you coerce values into specific types. You stated that you managed to get the code working when you provided a numeric literal like 0 or 1, so it seems that your connections method will accept an Integer, but your i variable might implicitly be a Long, given how it is declared.
You could check this by assigning a numeric literal (which will default to an Integer type) to i, like this:
i = 0
iSessions = application.Connections.Item(i).Sessions.Count
msgbox iSessions & " Sessions for Connection " & i
Sometimes, a COM object doesn't let you access a child member without having a full handle to the parent first, so a more elaborate test would be:
i = 0
Set con = application.Connections.Item(i)
iSessions = con.Sessions.Count
msgbox iSessions & " Sessions for Connection " & i
If either of the above work, then you have a clue that the Connections.Item method is requiring an Integer. So you could potentially get this to work:
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
'The connections.Count method might coerce a Long or an Integer, or even a Byte
iConnections = application.Connections.Count
If iConnections > 0 Then
'Convert iConnections to an Integer, and i should then be an Integer too
For i = 0 to CInt(iConnections) - 1
set con = application.Connections.Item(i)
iSessions = con.Sessions.Count
msgbox iSessions & " Sessions for Connection " & i + 1
Next
End If