Author | Message | Time |
---|---|---|
OuTLawZGoSu | I need to save a text file with this format in the name: " [<current time>] Saved Chat.txt " When I hit Save, the file doesent save. What am I doing wrong? [code] Private Sub Save_Click() Form1.rtb.SaveFile (App.Path & "[ " & Format(Time, "hh:mm:ss") & " ] " & "SavedChat.txt") End Sub Private Sub Load_Click() Form8.cd1.Filter = "Text Files(*.txt)|*.txt|All Files(*.*)|*.*" Form8.cd1.ShowOpen Form8.rtbload.LoadFile Form8.cd1.FileTitle End Sub [/code] | January 14, 2004, 12:43 AM |
K | One problem I see right of the bat is that you can't have colons in a file name. (or backslashes either, in case you're saving the date as well). Try replacing them with dashes, commas, or periods. | January 14, 2004, 12:47 AM |
OuTLawZGoSu | Form1.rtb.SaveFile App.Path & ("\[ " & Format(Time, "hh-mm-ss") & " ] " & "SavedChat.txt") thx | January 14, 2004, 1:13 AM |
CrAzY | Eh, your doing it all wrong. You need to open a txt file there should be a code for that. I forget it off the top of my head. | January 14, 2004, 1:41 PM |
K | [quote author=CrAzY link=board=31;threadid=4705;start=0#msg39572 date=1074087714] Eh, your doing it all wrong. You need to open a txt file there should be a code for that. I forget it off the top of my head. [/quote] Actually, the Richtextbox control has a save method which will save its contents to a file. Why do things the long way when you can do it like he's doing it? | January 14, 2004, 4:41 PM |
Newby | [code]Dim YOURFILENAME as String YOURFILENAME = "ChannelLog.txt" Open App.Path & YOURFILENAME for Append as #1 Print #1, TEXTTOPRINT Close #1[/code] There you go. | January 16, 2004, 1:45 AM |
Stealth | Better to make YOURFILENAME a Const unless you'll be modifying it at runtime. Also, you named it like a constant -- all-uppercase name. | January 16, 2004, 4:42 AM |
Newby | Well, I just put that there so he could copy/paste that and change the channel log name. :P Unless you want me to o_O [code] Dim YOURFILENAME as String [/code]becomes [code] Private Const YOURFILENAME = "ChannelLog.txt" [/code] | January 16, 2004, 5:24 AM |
Ersan | You need to include a backslash before your filename, after App.Path [code]Dim YOURFILENAME as String YOURFILENAME = "\ChannelLog.txt" Open App.Path & YOURFILENAME for Append as #1 Print #1, TEXTTOPRINT Close #1[/code] | January 16, 2004, 2:24 PM |