File Creation using CommonDialog control:   Return to List

Private Sub cmdSaveAsTextFile_Click()
Dim fn As Integer
fn = FreeFile
' Common Dialog included in order to navigate to particular dir for a file save operation
With CommDlg
    .DialogTitle = "Save Text in Textbox to DOS Text file"
    .InitDir = "C:\"
    .ShowSave
End With
Open CommDlg.FileName For Binary As #fn
Put #fn, , Text1.Text
Close #fn
Text1.Text = ""
MsgBox "Textbox text successfully saved in " & CommDlg.FileName
End Sub



Note to Webmaster