CommonDialog1.CancelError = TrueCommonDialog1.Filter = "网页|*.htm;*.html"Command1.Caption = "打开"Command2.Caption = "保存"
On Error Resume NextDim TextLine As StringCommonDialog1.ShowOpenIf Err <> 32755 Then Text1 = ""'打开文件Open CommonDialog1.filename For Input As #1Do While Not EOF(1) Line Input #1, TextLine'去掉左边和右边的空格,再换行Text1 = Text1 & Trim(TextLine) & vbCrLf'若上面这句换成:' Text1 = Text1 & Trim(TextLine)'即去掉空格但不换行,这样,压缩率更大,但是它的可读性就差多了Loop Close #1End If
Text1 = ""'打开文件Open CommonDialog1.filename For Input As #1Do While Not EOF(1) Line Input #1, TextLine'去掉左边和右边的空格,再换行Text1 = Text1 & Trim(TextLine) & vbCrLf'若上面这句换成:' Text1 = Text1 & Trim(TextLine)'即去掉空格但不换行,这样,压缩率更大,但是它的可读性就差多了Loop Close #1End If
Line Input #1, TextLine'去掉左边和右边的空格,再换行Text1 = Text1 & Trim(TextLine) & vbCrLf'若上面这句换成:' Text1 = Text1 & Trim(TextLine)'即去掉空格但不换行,这样,压缩率更大,但是它的可读性就差多了
On Error Resume Next CommonDialog1.ShowSaveIf Err <> 32755 Then'保存文件Open CommonDialog1.filename For Output As #1 Print #1, Text1Close #1End If
Print #1, Text1
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18