Private Sub Command3_Click()
    CommonDialog1.Filter = "Rich Text Format files|*.rtf"
   CommonDialog1.ShowSave
   RichText.SaveFile CommonDialog1.FileName, rtfText
End Sub 目前我这个按钮的功能只能吧东西保存为RTF格式
怎么把文本内容以txt和doc方式保存?  怎么改?

解决方案 »

  1.   

         CommonDialog1.Filter = "Rich Text Format files|*.rtf|doc files|*.doc|文本|*.txt"  
          '取所打开文件的类型
           s$ = Left(sFileName, Len(sFileName) - 6)
           s1$ = Right(s$, 3)
           '确定保存文件的类型
           Select Case s1$
             Case "rtf", "RTF"
                bFileType = 0
             Case "doc", "DOC"
                bFileType = 1
             Case "txt", "TXT"
                bFileType = 2
             Case Else
                bFileType = 2
           End Select
           '保存文件
           RtbTxt.SaveFile CommonDialog1.FileName, bFileType
      

  2.   

    上面发错了,更正
        CommonDialog1.Filter = "Rich Text Format files|*.rtf|doc files|*.doc|文本|*.txt"  
        CommonDialog1.ShowSave 
         '取所打开文件的类型 
           s = Right(CommonDialog1.FileName, 3) 
          '确定保存文件的类型 
          Select Case s 
            Case "rtf", "RTF" 
                bFileType = 0 
            Case "doc", "DOC" 
                bFileType = 1 
            Case "txt", "TXT" 
                bFileType = 2 
            Case Else 
                bFileType = 2 
          End Select 
          '保存文件 
          RtbTxt.SaveFile CommonDialog1.FileName, bFileType 
      

  3.   

    什么错误?是不是RtbTxt没有替换成RichText
      

  4.   

    再试试这个
        CommonDialog1.Filter = "Rich Text Format files|*.rtf|doc files|*.doc|文本|*.txt"  
        CommonDialog1.ShowSave 
        '取所打开文件的类型 
          s = Right(CommonDialog1.FileName, 3) 
          '确定保存文件的类型 
          Select Case s 
            Case "rtf", "RTF" 
                bFileType = 0 
            Case "doc", "DOC" 
                bFileType = 0 
            Case "txt", "TXT" 
                bFileType = 1 
            Case Else 
                bFileType = 1 
          End Select 
          '保存文件 
          RichText.SaveFile CommonDialog1.FileName, bFileType