Hola a todos,
necesito llamar a un procedimiento almacenado de sql server desde excel y
pasarle parámetros. Sólo he conseguido realizar la llamada sin pasarle
ningún parámetro, el código es:
With
oHojaInforme.QueryTables.Add("OLEDB;Provider=SQLOLEDB.1;Password=adarra;Pers
ist Security Info=True;User ID=iproduccion;Initial Catalog=satool_urpe;Data
SourceARRA", oHojaInforme.Range("A2"))
.CommandType = xlCmdSql
.CommandText = "ProcExcel"
'.Parameters.Add 1, xlParamTypeVarChar
'.Parameters(1).SetParam xlConstant, "aaaa"
.Name = "Gastos acumulados"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Un saludo.
Leer las respuestas