VB程序运行时出现错误‘13’,类型不匹配, 有没有人给解释一下
PrivateSubCommandButton1_Click()Dimi,numberAsIntegerDimwpsno,wpsDIR,MyPathnumber=82Fo...
Private Sub CommandButton1_Click()
Dim i, number As Integer
Dim wpsno, wpsDIR, MyPath
number = 82
For i = 1 To number Step 2
If Len(Range("B" & i)) < 20 Then i = i + 1
wpsno = Range("B" & i).Value
wpsDIR = Range("D" & i).Value
'ThisWorkbook.SaveCopyAs "c:\xx.xls"
Set wshell = CreateObject("wscript.shell")
'MsgBox ThisWorkbook.Path
MyPath = ThisWorkbook.Path
'Set shotcut = wshell.createshortcut(wshell.specialfolders(MyPath) & "\" & wpsno & ".lnk")
Set shotcut = wshell.createshortcut(MyPath & "\" & wpsno & ".lnk")
shotcut.targetpath = wpsDIR
shotcut.windowstyle = 7
shotcut.Save
Set shotcut = Nothing
Set wshell = Nothing
Next i
End Sub
'"desktop"
我也不知道哪句话出错,这是excel的一个调用程序。 展开
Dim i, number As Integer
Dim wpsno, wpsDIR, MyPath
number = 82
For i = 1 To number Step 2
If Len(Range("B" & i)) < 20 Then i = i + 1
wpsno = Range("B" & i).Value
wpsDIR = Range("D" & i).Value
'ThisWorkbook.SaveCopyAs "c:\xx.xls"
Set wshell = CreateObject("wscript.shell")
'MsgBox ThisWorkbook.Path
MyPath = ThisWorkbook.Path
'Set shotcut = wshell.createshortcut(wshell.specialfolders(MyPath) & "\" & wpsno & ".lnk")
Set shotcut = wshell.createshortcut(MyPath & "\" & wpsno & ".lnk")
shotcut.targetpath = wpsDIR
shotcut.windowstyle = 7
shotcut.Save
Set shotcut = Nothing
Set wshell = Nothing
Next i
End Sub
'"desktop"
我也不知道哪句话出错,这是excel的一个调用程序。 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询