SetParam方法总结计划.docxVIP

  • 3
  • 0
  • 约小于1千字
  • 约 1页
  • 2021-10-12 发布于山东
  • 举报
SetParam方法总结计划 SetParam方法总结计划 PAGE PAGE1 SetParam方法总结计划 PAGE SetParam方法 定义指定查问表的参数。 expression.SetParam(Type,Value) expression 必要。该表达式返回“应用于”列表中的一个对象。 TypeXlParameterType 种类,必要。 XlParameterType 可为以下XlParameterType 常量之一。 xlConstant 使用Value 参数指定的值。 xlPrompt  显示提示用户输入值的对话框。  Value  参数指定的是对话框中显示的文字。 xlRange  使用地区左上角单元格的值。  Value  参数指定的是一个  Range  对象。 Value Variant 种类,必要。指定参数的值,如 Type参数的说明所示。 ExcelVBA教程:SetParam方法·示例 本示例改正第一张查问表的SQL语句。语句“(city=?)”表示此查问为参数查问,本示例将城市常量值设置为“Oakland”。 Setqt=Sheets(sheet1).QueryTables(1) =SELECT*FROMauthorsWHERE(city=?) Setparam1=qt.Parameters.Add(CityParameter,_ xlParamTypeVarChar) xlConstant,Oakland 本示例将city 的值设为第二张工作表中 A2单元格的值。 Setqt=Sheets(sheet1).QueryTables(1) =SELECT*FROMauthorsWHERE(city=?) Setparam1=qt.Parameters.Add(CityParameter,_ xlParamTypeVarChar) xlRange,Range(sheet2!a1)

文档评论(0)

1亿VIP精品文档

相关文档