我在这里的第一篇文章,但我已经潜伏了很长时间。我正在为一家公司工作,该公司使用Outlook的VB来自定义他们从自定义任务表单中所做的一切。好吧,我想通过激活一个能够:
的子项来增加这一点目前我在:
Dim fso
Dim sourceFol
Dim DestFol
Dim variable1
Dim variable2
Set fso = CreateObject("Scripting.FileSystemObject")
If ClientCode = "1" Then
sourceFol = "\\S:\sourcepath"
DestFol = "\\S:\destination\"& variable1 &" - "& variable2
ElseIf ClientCode = "2" Then
sourceFol = "\\S:\sourcepath"
DestFol = "\\S:\destination\"& variable1 &" - "& variable2
ElseIf ClientCode = "3" Then
sourceFol = "\\S:\sourcepath"
DestFol = "\\S:\destination\"& variable1 &" - "& variable2
End If
If Error Then
WScript.Echo "Error: " & Err.Number
WScript.Echo "Source: " & Err.Source & "Description:" & Err.Description
Err.Clear
Else
'Cancel
End If
唯一的问题是我从中得不到任何东西,没有反应,没有错误,也没有从我所看到的东西中思考。看到这只是我名单上的第一名,我什么都没得到,这非常令人沮丧。在这种情况下,任何人都有任何好的提示,指针或要检查的东西?感谢。
答案 0 :(得分:0)
这段代码需要走很长的路。但这里是代码的修订版,因此您可以获得输出。
Dim fso
Dim sourceFol
Dim DestFol
Dim variable1
Dim variable2
Dim result
Set fso = CreateObject("Scripting.FileSystemObject")
If ClientCode = "1" Then
sourceFol = "\\S:\sourcepath"
DestFol = "\\S:\destination\"& variable1 &" - "& variable2
result = "Succeeded in string set: 1"
ElseIf ClientCode = "2" Then
sourceFol = "\\S:\sourcepath"
DestFol = "\\S:\destination\"& variable1 &" - "& variable2
result = "Succeeded in string set: 2"
ElseIf ClientCode = "3" Then
sourceFol = "\\S:\sourcepath"
DestFol = "\\S:\destination\"& variable1 &" - "& variable2
result = "Succeeded in string set: 1"
Else
result = "Client Code did not match comparison results [" & ClientCode & "]"
End If
If Err.Number<>0 Then
WScript.Echo "Error: " & Err.Number
WScript.Echo "Source: " & Err.Source & "Description:" & Err.Description
Err.Clear
Else
wscript.echo result
End If
答案 1 :(得分:0)
Dim fso
Dim clientcode
Dim variable1
Dim variable2
Dim Folder
ClientCode = Trim(Item.UserProperties("Client"))
If ClientCode = "1" Then
folder = "R:\path"& variable1 &"-"& variable2
ElseIf ClientCode = "2" Then
folder = "R:\01 - CHA\"& variable1 &"-"& variable2
ElseIf ClientCode = "3" Then
folder = "R:\03 - REOR\"& variable1 &"-"& variable2
End if
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(folder) Then
fso.CreateFolder (folder)
MsgBox "Folder Successfully Created and Named"
Else
MsgBox folder & " already exists!", vbExclamation, "Folder Exists"
End If