Hello Saad,
'--------------------------Start Excel VBA Sub-----------------------------
Sub SAP_OpenSessionFromLogon()
Dim SapGui
Dim Applic
Dim connection
Dim session
Shell ("C:\Program Files\SAP\FrontEnd\SAPgui\saplogon.exe")
Set SapGui = GetObject("SAPGUI")
Rem Create the GuiApplication object
Set Applic = SapGui.GetScriptingEngine
Rem Open a connection
Set connection = Applic.OpenConnection("QE1 - ERP QA ECC 6.0", True) '<=== here you need to fillin your connection description
Set session = connection.Children(0)
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "800"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "Test1"
session.findById("wnd[0]").sendVKey 0
Rem Do something: Either fill out the login screen
Rem or in case of Single-Sign-On start a transaction.
session.SendCommand ("/nbibs")
MsgBox "Waiting..."
Rem Shutdown the connection
Set session = Nothing
connection.CloseSession ("ses[0]")
Set connection = Nothing
Set sap = Nothing
MsgBox "Done"
End Sub
'--------------------------End of Excel VBA Sub----------------------------
Just fillin the description from your system in row where 'Set connection' is defined.
If you have any questions let me know. Br, Holger