-
How do I code a Save routine for a common dialog control ? I want to save the text from a text box to a file. I can make the Save as dialog appear but I don't know where and what to put for the save...
Any hint, code or examples will be appreciated...
Hemang
-
This code open a file for output and writes the contents of a textbox (named Text1)
Code:
Dim sFileName As String, iFile as Integer
With CommonDialog1
.Flags = cdlOfnPathMustExist + cdlOfnOverWritePrompt
.CancelError = True
On Error Resume Next
Err.Clear
.ShowSave
If Err <> cdlCancel Then
iFile = FreeFile
sFileName = .FileName
Open sFileName For Output As #iFile
Print #iFile, Text1.Text
Close #iFile
End If
End With
Good luck!