我对以下代码有疑问:
month = Me.monthcbg.Value
year = Me.yrcbg.Value
If Len(Dir("L:\NAI_Groups\IS Monthly Operations Meeting\" & year, vbDirectory)) = 0 Then
MkDir "L:\NAI_Groups\IS Monthly Operations Meeting\" & year
End If
If Len(Dir("L:\NAI_Groups\IS Monthly Operations Meeting\" & year & "\" & month, vbDirectory)) = 0 Then
MkDir "L:\NAI_Groups\IS Monthly Operations Meeting\" & year & "\" & month
MkDir "L:\NAI_Groups\IS Monthly Operations Meeting\" & year & "\" & month & "\1_LOP"
MkDir "L:\NAI_Groups\IS Monthly Operations Meeting\" & year & "\" & month & "\2_Plants_Operations"
MkDir "L:\NAI_Groups\IS Monthly Operations Meeting\" & year & "\" & month & "\3_Logistics_Purchasing_IT"
MkDir "L:\NAI_Groups\IS Monthly Operations Meeting\" & year & "\" & month & "\4_Development_Changes"
ElseIf Len(Dir("L:\NAI_Groups\IS Monthly Operations Meeting\" & year & "\" & month, vbDirectory)) <> 0 Then
mes = MsgBox("A presentation already exists, would you like to overwrite the existing presentation?", vbYesNo, "Presentation Exists")
If mes = vbNo Then
Exit Sub
ElseIf mes = vbYes Then
On Error Resume Next
Kill "L:\NAI_Groups\IS Monthly Operations Meeting\" & year & "\" & month & "\1_LOP\" & month & "\" & year & ".pptx"
MsgBox "Old Presentation Deleted"
Set Error = 0
End If
End If
月份和年份被标注为字符串。第一个问题是即使没有现有目录,msgbox 总是出现,第二个问题是即使选择了 vbyes 代码也不会创建目录。
谢谢