我要在菜单中 加入一项 新建文本文件 
当点击时 弹出对话框 要求输入文件名 然后保存  如果与已有文件重名  则提示请问如何实现啊  

解决方案 »

  1.   

    用一个通用对话框控件commondialog1
    dim sfile as string
    private sub mnunew_click()
      sfile=""
      commondialog1.showsave
      sfile=commondialog1.filename
      if dir(sfile)<>"" then
        dim r as integer
        r=msgbox("文件已经存在,是否覆盖?",vbyesno+vbquestion,"提示")
        if r=vbno then exit sub
      end if
      open sfile for output as #1
      print #1,欲写入的内容
      close #1
    end sub
      

  2.   

    感谢happy_sea得代码  同时也感谢zcsor(偶是业余的,也斗胆写了点blog,欢迎初学者参观)得建议,,,happy_sea的代码基本上就是我要实现的感谢两位