用一个通用对话框控件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
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