Results 1 to 2 of 2

Thread: Save As question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253

    Question

    Private Sub mnuFileSaveAs_Click()

    CommonDialog1.Filter = "Text (*.txt)|*.txt|" 'You can add other File Names here
    CommonDialog1.ShowSave

    Open CommonDialog1.Filename For Output As #1
    Print #1, Text1.Text
    Close #1

    End Sub

    I'm getting an error 75 path/file access error when I go to save the file, but then selected cancel button instead.

    Can anyone help?

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    set the cancelerror property to true. then catch the error.

    Code:
    Private Sub mnuFileSaveAs_Click() 
    on local error goto errhandler
    commondialog1.cancelerror = true
    CommonDialog1.Filter = "Text (*.txt)|*.txt|" 'You can add other File Names here 
    CommonDialog1.ShowSave 
    
    Open CommonDialog1.Filename For Output As #1 
    Print #1, Text1.Text 
    Close #1 
    errhandler:
    'catch cancel error here
    End Sub
    You can also set the cancelerror in design view

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