菜鸟求助!VB6缺少END SUB
PrivateSubCommand1_Click()FunctionLoadVBS()DimRetValSetWshShell=CreateObject("Wscript...
Private Sub Command1_Click()
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Function
Private Sub Command2_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\qq.VBS", 1, True)
Set WshShell = Nothing
End Sub
就这个程序
按钮二没问题,就按钮一,怎么办?
改成这样了
Private Sub Command1_Click()
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Sub
Private Sub Command2_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\qq.VBS", 1, True)
Set WshShell = Nothing
End Sub
还是不对... 展开
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Function
Private Sub Command2_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\qq.VBS", 1, True)
Set WshShell = Nothing
End Sub
就这个程序
按钮二没问题,就按钮一,怎么办?
改成这样了
Private Sub Command1_Click()
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Sub
Private Sub Command2_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\qq.VBS", 1, True)
Set WshShell = Nothing
End Sub
还是不对... 展开
展开全部
.......
.......
问题补充:
改成这样了
Private Sub Command1_Click()
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Sub
......
......
以上是你问题的内容
/////////////////////////////////////////////////
把这一段改成:
Private Sub Command1_Click()
call LoadVBS
End Sub
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
这样就可以了,就是把一段程序分成两段,把Function LoadVBS()过程不写在Command1_Click()内,你复制到VB试试
.......
问题补充:
改成这样了
Private Sub Command1_Click()
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Sub
......
......
以上是你问题的内容
/////////////////////////////////////////////////
把这一段改成:
Private Sub Command1_Click()
call LoadVBS
End Sub
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
这样就可以了,就是把一段程序分成两段,把Function LoadVBS()过程不写在Command1_Click()内,你复制到VB试试
展开全部
Private Sub Command1_Click()
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Function
这里结尾有两个end function,最后一个改成end sub.还有你自己写的函数可以写在别处,而在command1_click中直接调用函数名就可以了。
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Function
这里结尾有两个end function,最后一个改成end sub.还有你自己写的函数可以写在别处,而在command1_click中直接调用函数名就可以了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Function
改成
Private Sub Command1_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Sub
就行了
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Function
改成
Private Sub Command1_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Sub
就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
function怎么写到click事件里去了
把function写独立的模块
private function loadvbs()
......
end function
然后在click里调用function
把function写独立的模块
private function loadvbs()
......
end function
然后在click里调用function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你该成这样看看
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Function
Private Sub Command2_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\qq.VBS", 1, True)
Set WshShell = Nothing
End Sub
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
End Function
Private Sub Command2_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\qq.VBS", 1, True)
Set WshShell = Nothing
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这样可以了:
Private Sub Command1_Click()
Call LoadVBS
End Sub
Private Sub Command2_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\qq.VBS", 1, True)
Set WshShell = Nothing
End Sub
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
顺便说一句,你是用VB写的了 干嘛还用这个VBS对象啊..?
直接:
Private Sub Command1_Click()
shell "cmd /c start D:\VBS\GOOGLEEARTH.VBS",vbHide
End Sub
Private Sub Command2_Click()
shell "cmd /c start D:\VBS\qq.VBS",vbHide
End Sub
Private Sub Command1_Click()
Call LoadVBS
End Sub
Private Sub Command2_Click()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\qq.VBS", 1, True)
Set WshShell = Nothing
End Sub
Function LoadVBS()
Dim RetVal
Set WshShell = CreateObject("Wscript.Shell")
RetVal = WshShell.Run("D:\VBS\GOOGLEEARTH.VBS", 1, True)
Set WshShell = Nothing
End Function
顺便说一句,你是用VB写的了 干嘛还用这个VBS对象啊..?
直接:
Private Sub Command1_Click()
shell "cmd /c start D:\VBS\GOOGLEEARTH.VBS",vbHide
End Sub
Private Sub Command2_Click()
shell "cmd /c start D:\VBS\qq.VBS",vbHide
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询