guys,
below is my code to save the data in notepad
can anyone pls teach me how to autosave cos this code there will be a pop up window for saving..
thanks a lot.
Dim array_data As String
Dim x As Integer
Dim list_array As Variant
List1.Clear
array_data = "yes"
CommonDialog1.C ancelError = True
On Error GoTo CancelButton
CommonDialog1.F ilter = "Text files (*.txt|*.txt"
CommonDialog1.S howSave
Newfile = CommonDialog1.F ileName
Open Newfile For Output As #1
If array_data <> "" Then
ReDim Preserve received_data(T ext3.Text)
For x = 0 To Text3.Text
received_data(x ) = x & "," & array_data
Next x
End If
For Each list_array In received_data
Write #1, list_array
List1.AddItem List1.Text & vbCrLf & list_array
Next
Close #1
CancelButton:
Exit Sub
It is very likely you do not need this here:
-
-
CommonDialog1.CancelError = True
-
On Error GoTo CancelButton
-
CommonDialog1.Filter = "Text files (*.txt|*.txt"
-
CommonDialog1.ShowSave
-
Newfile = CommonDialog1.FileName
-
-
Above deals with your dialog box, which you do not need. Could you do me a bg favour and delete the lines one by one, then run your code. I cannnot try this as of now:
(1) Delete "CommonDialog1. CancelError = True", then run code
(2) Delete "On Error GoTo CancelButton" then run code
(3) If code runs fine, delete:
CommonDialog1.F ilter = "Text files (*.txt|*.txt"
CommonDialog1.S howSave
(4) Lastly, delete "Newfile = CommonDialog1.F ileName", only if pop up nop longer come up.
Anyone, please assist keeaun, I must run and cannot run this as of now. keeaun,
please save this project before you do what I suggested, but I would delete the dialog data if I did not want to get a pop up before saving.
In a bit!
Dököll