Sub manual()
'------------------------------------------------------------------
Application.ScreenUpdating = False
Dim res As Worksheet
Dim ss As String '------------ use CSDB directly
Dim bdate As String
Dim edate As String
Sheets("ETCH").Activate
Set res = Sheets("ETCH").Sheets1
res.Cells.Range("A:V").ClearContents
bdate = Sheets("eap").TextBox1.Text
edate = Sheets("eap").TextBox2.TextSql = " select lotid,lottype,evtime,evvariant,partname,evuser from hist_lotevents@odsprd"
Sql = Sql & " where evvariant in ('AEPE01','AEPE02','AENE01','AEME01','AEME02','AEOE01','AEOE02','AEAS01','AEAS02','AWCL01','AWCL03','AWME01','AWST01','AWNR01','AWSE01','AEUV01')"
Sql = Sql & " and evtype='NTKI'"
Sql = Sql & " and fun_get_histlotevents_cmt(lotid,evtime) not like '%RUN=A%'"
Sql = Sql & " and evtime>=to_date(' " & bdate & " ', 'YYYY-MM-DD')"
Sql = Sql & " and evtime<to_date(' " & edate & " ', 'YYYY-MM-DD'))"ss = "ODBC;DSN=MFGPRD;UID=rptprd;PWD=mfgrptprd;server=MFGPRD" With ActiveSheet.QueryTables.Add(Connection:=ss, Destination:=Worksheets("ETCH").Range("A1"), Sql:=Sql)
.BackgroundQuery = False
.Refresh
End With
End Sub
以上颜色地方 下标出界 解释下
'------------------------------------------------------------------
Application.ScreenUpdating = False
Dim res As Worksheet
Dim ss As String '------------ use CSDB directly
Dim bdate As String
Dim edate As String
Sheets("ETCH").Activate
Set res = Sheets("ETCH").Sheets1
res.Cells.Range("A:V").ClearContents
bdate = Sheets("eap").TextBox1.Text
edate = Sheets("eap").TextBox2.TextSql = " select lotid,lottype,evtime,evvariant,partname,evuser from hist_lotevents@odsprd"
Sql = Sql & " where evvariant in ('AEPE01','AEPE02','AENE01','AEME01','AEME02','AEOE01','AEOE02','AEAS01','AEAS02','AWCL01','AWCL03','AWME01','AWST01','AWNR01','AWSE01','AEUV01')"
Sql = Sql & " and evtype='NTKI'"
Sql = Sql & " and fun_get_histlotevents_cmt(lotid,evtime) not like '%RUN=A%'"
Sql = Sql & " and evtime>=to_date(' " & bdate & " ', 'YYYY-MM-DD')"
Sql = Sql & " and evtime<to_date(' " & edate & " ', 'YYYY-MM-DD'))"ss = "ODBC;DSN=MFGPRD;UID=rptprd;PWD=mfgrptprd;server=MFGPRD" With ActiveSheet.QueryTables.Add(Connection:=ss, Destination:=Worksheets("ETCH").Range("A1"), Sql:=Sql)
.BackgroundQuery = False
.Refresh
End With
End Sub
以上颜色地方 下标出界 解释下
解决方案 »
- 请问如何用VB判断系统时间是否在9:30到11:30 或 13:00 到15:00 之间?
- 本人毕业设计弄好了,就差一个摘要翻译了,请各位高手帮帮忙,本人英语水平实在有限,翻译了一天,也没翻译出个所以然来!谢谢了!
- 攒机,大家给点建议。谢谢先
- winsock问题100分
- 求助!!VB中可以把菜单和工具拦连接起来的方法吗??
- 用VB做的系统数据库参数连接配置
- 顶顶也有分! 对我来说,难度>∞(在线结帖)
- 代码:实现总在最前面的窗口。
- 三级终于结束了,散分了。。
- 谢谢
- excel 2000 连接 oracle10.2.1 <急救>
- Here are some frequently asked VB questions that may be useful for beginners.
Set res = Sheets("ETCH").Sheets1
先后顺序颠倒了,
Set res = Sheets("ETCH").Sheets1
Sheets("ETCH").Activate
试一试
检查你的sheet是否有ETCH命名,是否有拼写错误Sub manual()
'------------------------------------------------------------------
Application.ScreenUpdating = False
Dim res As Worksheet
Dim ss As String '------------ use CSDB directly
Dim bdate As String
Dim edate As String
Sheets("ETCH").Activate
Cells(1, 1) = "ok"
End Sub