I have connection in Excel that uses a SQL Server stored procedures with two date parameters. In the connection properties I can successfully run the query with the following command in the command text:
exec SW_Maintenance_GL '2018-09-01','2018-09-30'
However, when I try and replace this with the following in order to pick up two dates entered into worksheet cells:
exec SW_Maintenance_GL '" & Range("H1").text & "','" & Range("I1").text & "'
I get the following error:
Error converting data type varchar to date
The actual value in theses cells is shown as 01/09/2018 although it is formatted as 2018-09-01 and I presumed that using Range("I1").text
instead of Range("I1").value
would have worked??
Thanks in advance