I'm a newbie in VBA. I have a simple VBA code that I used to get status/utilization of certain ckts on a particular GSM network element...hosted on a unix server. It is still in its raw state. At least it may give you an idea or something...
hope this helps.
Option Explicit
Dim Reflection2 As Reflection2.Application
Dim appExcel As Excel.Application
Dim row As Integer
Dim bscnum As Integer
Dim btsnum As Integer
Public Sub Main()
Set appExcel = CreateObject("Excel.application")
Workbooks("excelfile").Activate
Set Reflection2 = CreateObject("Reflection2.Application")
With Reflection2
'.Visible = True
If .Connected = False Then
.ConnectionType = "TELNET"
.ConnectionSettings = "Host 10.126.254.170" 'GSM
.Connect
End If
.ProcessDataComm = False
.WaitForString "login:"
.Transmit ("myname") & vbCr
.WaitForString "Password:"
.Transmit ("mypaswd") & vbCr
.WaitForString "myname%"
row = 3
Do Until Sheets("Sheet1").Cells(row, 3).Value = ""
btsnum = Sheets("Sheet1").Cells(row, 3).Value
bscnum = Sheets("Sheet1").Cells(row, 2).Value
.Transmit "bsc command -n bsc" & bscnum & vbCr
.WaitForString "< "
ZEELBTS
row = row + 1
Loop
.Transmit vbCr
.Transmit "exit" & vbCr
.Disconnect
.ProcessDataComm = True
.Quit
End With
MsgBox "Done"
End
End Sub
Private Sub ZEELBTS()
Dim lineread As String
Dim AlarmTime As String
Dim bfr As String
Dim bhr As String
Dim ifr As String
Dim ihr As String
Dim bsd As String
Dim isd As String
Dim brts As String
Dim gprsts As String
With Reflection2
.ProcessDataComm = False
.Transmit "ZEEL::BTS=" & btsnum & ";" & vbCr
Do While Not InStr(1, lineread, "<EE_>")
lineread = .ReadLine
Sheets("Sheet1").Cells(1, 1).Value = lineread
If Trim(lineread <> "") And InStr(1, lineread, "BSC4i_198") Then
AlarmTime = Mid(lineread, 37, 20)
ElseIf InStr(1, lineread, "BUSY FULL RATE") Then
bfr = Mid(lineread, 37, 3)
ElseIf InStr(1, lineread, "BUSY HALF RATE") Then
bhr = Mid(lineread, 37, 3)
ElseIf InStr(1, lineread, "IDLE FULL RATE") Then
ifr = Mid(lineread, 37, 3)
ElseIf InStr(1, lineread, "IDLE HALF RATE") Then
ihr = Mid(lineread, 37, 3)
ElseIf InStr(1, lineread, "BUSY SDCCH") Then
bsd = Mid(lineread, 37, 3)
ElseIf InStr(1, lineread, "IDLE SDCCH") Then
isd = Mid(lineread, 37, 3)
ElseIf InStr(1, lineread, "BLOCKED RADIO TIME SLOTS") Then
brts = Mid(lineread, 37, 3)
ElseIf InStr(1, lineread, "GPRS TIME SLOTS") Then
gprsts = Mid(lineread, 37, 3)
ElseIf InStr(1, lineread, "COMMAND EXECUTED") Then
Sheets("Sheet1").Cells(row, 1).Value = "'" & AlarmTime
Sheets("Sheet1").Cells(row, 5).Value = bfr
Sheets("Sheet1").Cells(row, 6).Value = bhr
Sheets("Sheet1").Cells(row, 7).Value = ifr
Sheets("Sheet1").Cells(row, 8).Value = ihr
Sheets("Sheet1").Cells(row, 10).Value = bsd
Sheets("Sheet1").Cells(row, 11).Value = isd
Sheets("Sheet1").Cells(row, 13).Value = brts
Sheets("Sheet1").Cells(row, 14).Value = gprsts
ElseIf InStr(1, lineread, "<EE_>") Then
Exit Do
End If
DoEvents
Loop
.Transmit "ZZZ;" & vbCr
.WaitForString "continue"
.Transmit " " & vbCr
.ProcessDataComm = True
End With
End Sub