Hi,
I need to run a SQL Server 2005 stored procedure by pressing a command button in excel 2003 (VisualBasic 6.3).
Searched and tried many solutions here and in other web resources, read about opening the datasource, but I cannot find the exact solution for my problem.
Any help would be greatly appreciated,
Thanks
I hope that I understad your problem correctly and that this will help:
You must first connect to the DB.
Use VB Code something like this in design view in Excel:
Vcmp.Server = "CENTURIONDC"
Vcmp.CompanyDB = "AS_TSH_PRD"
Vcmp.UserName = InputBox("Enter your user name", "User Name")
Vcmp.Password = InputBox("Enter your password", "Password")
Vcmp.DbUserName = "sa"
Vcmp.DbPassword = "salerta"
Vcmp.Language = ln_English
Vcmp.UseTrusted = False
rt = Vcmp.Connect()
Debug.Print "Connect result:"; rt
Remember the references must be added by using Tools > References... and Vcmp must be declared by using your references.
When connected, you can retrieve data or post data to the DB.
Regards