Hello! I'm having problem writing or saving string to a text file particularly into notepad. Here's my code:
DbaseString - variable for my string
Dim f, a
Dim inFileNumber As Integer
Dim strLine As String
Dim lngFileLength As Integer
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.DialogTitle = "Select a file name"
CommonDialog1.Flags = cdlOFNHideReadOnly
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files" & _
"(*.txt)|*.txt|Batch Files (*.bat)|*.bat"
CommonDialog1.FilterIndex = 2
MsgBox "Save to Path: " + CommonDialog1.FileName
intFileNumber = FreeFile
lngFileLength = FileLen(CommonDialog1.FileName)
Open CommonDialog1.FileName For Input As intFileNumber _
Len = lngFileLength
txtDocument.Text = Input$(lngFileLength, intFileNumber)
Set f = fs.OpenTextFile(CommonDialog1.FileName, ForWriting, TristateFalse)
I'm not sure with the other codes. I just tried them and they work fine. I think what's lack in there is the saving or writing string into text file. Is this code,
suppose to write string to text file?
This codes is about locating the text file through commondialog box and then I want to save my string to that text file. Just overwrite any characters save in there if there is.
I will appreciate any of your help. Thank you in advance.