VB提示路径/文件访问错误,是怎么回事,哪位大侠帮帮忙!!
代码是PublicSub退出_Click()DimRarexeAsString'WINRAR执行文件的位置DimSourceAsString'压缩前的原始文件DimTar...
代码是
Public Sub 退出_Click()
Dim Rarexe As String 'WINRAR执行文件的位置
Dim Source As String ' 压缩前的原始文件
Dim Target As String ' 压缩后的目标文件
Dim FileString As String 'Shell指令中的字符串
Dim Result As Long
Dim objWMIService As Object
Dim colProcesslist As Object
Dim objProcess As Object
Rarexe = "C:\Program Files\WinRAR\WinRAR.exe"
Source = App.Path + "\平台拆除资料管理"
Target = App.Path + "\file.rar"
FileString = Rarexe & " a -ep1 -o+ -df -pzhdl " & Target & " " & Source
Set fso = CreateObject("Scripting.FileSystemObject") '判断文件是否存在
If fso.FolderExists(Source) Then
Result = Shell(FileString, vbHide)
End If
MkDir App.Path + "\平台拆除资料管理"
MkDir App.Path + "\平台拆除资料管理\平台拆除资料管理"
Set objWMIService = CreateObject("winmgmts:{impersonationLevel=Impersonate}!root\cimv2")
Set colProcesslist = objWMIService.ExecQuery("select * from win32_process where name='Winrar.exe'") '进程名
For Each objProcess In colProcesslist
objProcess.Terminate
Next
Unload Me
End Sub
其中提示MkDir App.Path + "\平台拆除资料管理"
MkDir App.Path + "\平台拆除资料管理\平台拆除资料管理"出错 展开
Public Sub 退出_Click()
Dim Rarexe As String 'WINRAR执行文件的位置
Dim Source As String ' 压缩前的原始文件
Dim Target As String ' 压缩后的目标文件
Dim FileString As String 'Shell指令中的字符串
Dim Result As Long
Dim objWMIService As Object
Dim colProcesslist As Object
Dim objProcess As Object
Rarexe = "C:\Program Files\WinRAR\WinRAR.exe"
Source = App.Path + "\平台拆除资料管理"
Target = App.Path + "\file.rar"
FileString = Rarexe & " a -ep1 -o+ -df -pzhdl " & Target & " " & Source
Set fso = CreateObject("Scripting.FileSystemObject") '判断文件是否存在
If fso.FolderExists(Source) Then
Result = Shell(FileString, vbHide)
End If
MkDir App.Path + "\平台拆除资料管理"
MkDir App.Path + "\平台拆除资料管理\平台拆除资料管理"
Set objWMIService = CreateObject("winmgmts:{impersonationLevel=Impersonate}!root\cimv2")
Set colProcesslist = objWMIService.ExecQuery("select * from win32_process where name='Winrar.exe'") '进程名
For Each objProcess In colProcesslist
objProcess.Terminate
Next
Unload Me
End Sub
其中提示MkDir App.Path + "\平台拆除资料管理"
MkDir App.Path + "\平台拆除资料管理\平台拆除资料管理"出错 展开
1个回答
2009-04-09
展开全部
变量+字符的格式是用 & 做连接字符,前后空格
MkDir App.Path & "\平台拆除资料管理"
MkDir App.Path & "\平台拆除资料管理"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询