怎样实现记事本另存为时有同名文件存在的提示?

解决方案 »

  1.   

    Dim MyFile
    MyFile = Dir("C:\WINDOWS\WIN.ini")If MyFile <> "" Then    MsgBox MsgBox("WIN.ini文件已存在!是否xxx?", vbYesNoCancel)
        
    '返回值
    'vbOK     1 OK
    'vbCancel 2 Cancel
    'vbAbort  3 Abort
    'vbRetry  4 Retry
    'vbIgnore 5 Ignore
    'vbYes    6 Yes
    'vbNo     7 NoEnd If
      

  2.   


    Dim fso As New FileSystemObject
    if fso.FileExists "c:\test.txt" then
       msgbox "存在同名的文件!"
    end if
      

  3.   

    使用FSO得引用Microsoft Scripting Runtime
      

  4.   

    FileSystemObject是一个对象吗?FileExists是不是方法?我是初学者,很多东西不会,但我很喜欢VB。
      

  5.   

    FileSystemObject是一个关于文件处理的类。FileExists是它的一个方法。它有好多方法,你可以看看