Possible Duplicate:
How do I call WCF client from Excel 2003 VBA?
I want to call a web service developed using WCF from the Excel using VBA code. How can we do this ? I have tried the GetObject() method but I'm getting syntax error while using this. I want to display the data that I'm getting from the web service in Excel. Please help.
The DataContract is as follows:
`
[DataContract] 
public class Data
{
    [DataMember]
    public int Id;
    [DataMember]
    public DateTime LockTime;
    [DataMember]
    public DateTime LoginTime;
    [DataMember]
    public DateTime LastDefenitionDate;
    [DataMember]
    public string NTLogin;
    [DataMember]
    public string SystemName;
}
ServiceContract is as follows:
`
[ServiceContract]
interface IDataService
{
    [OperationContract]
    List<Data> GetData();
    [OperationContract]
    void SubmitData(Data data);
}
`
DataService for accessing database is as follows:
`
[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
public class DataService : IDataService { public static SQLConnection SQLDBConnection = new SQLConnection();
    #region IDataService Members
    public List<Data> GetData()
    {
        List<Data> datas = new List<Data>();
        try
        {
            if (SQLDBConnection.con.State == ConnectionState.Closed) SQLDBConnection.con.Open();
            datas.Clear();
            SqlCommand sqlcommand = new SqlCommand();
            sqlcommand.Connection = SQLDBConnection.con;
            sqlcommand.CommandText = "select * from tblData";
            sqlcommand.CommandType = CommandType.Text;
            SqlDataAdapter sqladapter = new SqlDataAdapter(sqlcommand);
            DataTable dt = new DataTable();
            sqladapter.Fill(dt);
            Data data = null;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                data = new Data();
                data.Id = Convert.ToInt32(dt.Rows[i]["id"]);
                data.NTLogin = dt.Rows[i]["NTLogin"].ToString();
                data.SystemName = dt.Rows[i]["SystemName"].ToString();
                data.LockTime = Convert.ToDateTime(dt.Rows[i]["LockTime"]);
                data.LoginTime = Convert.ToDateTime(dt.Rows[i]["LoginTime"]);
                data.LastDefenitionDate = Convert.ToDateTime(dt.Rows[i]["LastDefenitionDate"]);
                datas.Add(data);
            }
        }
        catch (Exception ex)
        {  } 
        return datas;
    }
    public void SubmitData(Data data)
    {
        if (SQLDBConnection.con.State == ConnectionState.Closed) SQLDBConnection.con.Open();
        SqlCommand sqlcommand = new SqlCommand();
        sqlcommand.Connection = SQLDBConnection.con;
        sqlcommand.CommandText = "Insert into dbo.tblData(NTLogin, SystemName, LockTime, LoginTime, LastDefenitionDate) values ('" + data.NTLogin + "','" + data.SystemName + "','" + data.LockTime + "' , '" + data.LoginTime + "', '" + data.LastDefenitionDate + "')";
        sqlcommand.CommandType = CommandType.Text;
        int RowsAffected = sqlcommand.ExecuteNonQuery();
    }
    #endregion
}
`
EDIT:
The possible duplicate suggestion's answer didn't worked out for me. My entire code is given here. I have even checked that post, before posting my question. Please check my code.