Results 1 to 4 of 4

Thread: I can code my save mnu to work but...

  1. #1

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    I can code my save mnu to work but how can I code a Save As?

    I appreciate any help you have to offer,
    Daniel Christie

  2. #2
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    Open a common dialogue save box.

    Regards

    Chris
    VB6 VS2005

  3. #3
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    If you want to save a Rich Text Box as Rich Text File I found some code here (credits to Matthew Gates):
    Code:
    'AS RTF
    'Save
    RichTextBox1.SaveFile "C:\MyFile.rtf",
    'Load
    RichTextBox1.LoadFile "C:\MyFile.rtf",
    
    AS TXT
    'Save
    RichTextBox1.SaveFile "C:\MyFile.txt",
    
    'Load
    RichTextBox1.LoadFile "C:\MyFile.rtf",
    You can replace "C:\MyFile.rtf" or .txt in a string variable that was previously saved by a Save dialog.

    Good Luck
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  4. #4
    Guest
    To code save as, do as chrisa_uk suggested. Here is how to do that:

    Code:
    Private Sub mnuSave_Click()
        Dim iFile As Integer
        On Error GoTo User_Cancelled
        With CommonDialog1
        .CancelError = True
        .DialogTitle = "Save a Text File.."
        .Filter = "Txt files (*.txt)|*.txt"
        .ShowSave
        iFile = FreeFile
        Open .filename For Output As iFile
        Print #1, Text1.text
        Close iFile
        End With
    User_Cancelled:
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width