下面这条语句怎么不执行呢
…………
if dir(myfile & "\Room\Border.doc",vbNormal) = "Border.doc" and dir(myfile  _ 
& "\Class \Border.doc",vbNormal) = "Border.doc" then 
Num = Num + 5
else 
message = message & "你没有复制"
………………
为什么总是执行
Else 语句呢
也就是说 if 语句为什么得不到返回值
多谢‘
!!!!!

解决方案 »

  1.   

    你的 myfile 内容是什么?
      

  2.   

    你Debug一下,看看以下值是什么?dir(myfile & "\Room\Border.doc",vbNormal) 
      

  3.   

    肯定是dir中的值有问题,用F8检查一下吧
      

  4.   

    将返回的字串转换成大写或小写的看看if ucase(dir(myfile & "\Room\Border.doc",vbNormal)) = ucase("Border.doc") and ucase(dir(myfile  _ 
    & "\Class \Border.doc",vbNormal)) = ucase("Border.doc") then '转换成大写的
      

  5.   

    你Debug一下,看看以下值是什么?dir(myfile & "\Room\Border.doc",vbNormal) 将返回的字串转换成大写或小写的看看if ucase(dir(myfile & "\Room\Border.doc",vbNormal)) = ucase("Border.doc") and ucase(dir(myfile  _ 
    & "\Class \Border.doc",vbNormal)) = ucase("Border.doc") then '转换成大写的