sub baocun1 msg2=inputbox("请输入文件存储的完整路径,例如" & vbcrlf & vbcrlf & "C:\你的文件名.htm" & vbcrlf & vbcrlf & "文件名和后缀均可以自定义,但路径要正确","存储为固定文件","c:\新文件.htm") if msg2<>"" then on error resume next set filestr=fso.CreateTextFile(msg2,true) filestr.write bos.value filesrc=msg2 if err.number<>0 then msgbox "文件路径错误,请仔细检查是否有字符性错误",16,"存储路径未找到" end if end sub '未打开文件的保存函数 sub td2 if filesrc="" and bos.value="" then alert "编辑区以是空白文档,而你以前并未打开过文件,所以不需要在[新建]" if filesrc="" and bos.value<>"" then msg1=msgbox ("当前编辑区的内容,是否保存为固定文件?",3+32,"是=保存后新建,否=不保存新建,取消=取消操作") if msg1=vbYes then baocun1 bos.value="":bos.focus():filesrc="" elseif msg1=vbNo then bos.value="":bos.focus() end if end if if filesrc<>"" then msg1=msgbox ("当前正编辑的文件:" & filesrc & vbcrlf & vbcrlf & "是否还要保存?",3+32,"是=保存后新建,否=不保存新建,取消=取消操作") if msg1=vbYes then set filestr=fso.CreateTextFile(filesrc,true) filestr.write bos.value bos.value="":bos.focus() filesrc="":font3.innerText="" elseif msg1=vbNo then bos.value="":filesrc="":bos.focus():font3.innerText="" end if end if end sub '新建完毕 sub td3 files.click if document.all("files").value<>"" and document.all("files").value<>filesrc then set filestr=fso.GetFile(document.all("files").value).OpenAsTextStream(1,-2) bos.value=filestr.Readall bos.focus() filesrc=document.all("files").value font3.innerText=filesrc end if end sub '打开完毕 sub td4 if filesrc="" then baocun1 font3.innerText=filesrc:bos.focus() else set filestr=fso.CreateTextFile(filesrc,true) filestr.write(bos.value) bos.focus() end if end sub '保存完毕 sub td5 baocun1 font3.innerText=filesrc:bos.focus() end sub