Page 1 of 1

VB help

Posted: Tue May 24, 2005 3:54 pm
by Onetoomanysodas
I'm trying to make a program that automatically creates xml files for you with the given name entries. I don't care if you say that will never happen i just need to know how to create multiple lines when creating files.

I used vbcrlf so it knows to go to the next line but every time i test it it tells me the error is on the first line of the script but the problem is the multiple lines. How do i make it create multiple lines correctly?

Code: Select all

Private Sub create_Click()

Dim intMsg As String
Dim StudentName As String

Open "d:\0000\XML\assault rifle.coll.xml" For Output As #1
Text = txtfile.Text
Print #1, "<?xml version="""; 1#; """?>" + txtfile
vbCrLf "<!--Halo Map Tools: Metadata Structure File-->"
vbCrLf "blah blah blah"

Close #1

intMsg = MsgBox("assault rifle.coll.xml closed")
End Sub

EDIT: I think i might have just gotten it? before the vbcrlf i added

Code: Select all

output# 1 + ...

Posted: Tue May 24, 2005 4:29 pm
by Phenomena
add a & _ to the end of the lines

Code: Select all

Private Sub create_Click()

Dim intMsg As String
Dim StudentName As String

Open "d:\0000\XML\assault rifle.coll.xml" For Output As #1
Text = txtfile.Text
Print #1, "<?xml version="""; 1#; """?>" + txtfile & _
vbCrLf "<!--Halo Map Tools: Metadata Structure File-->" & _
vbCrLf "blah blah blah"

Close #1

intMsg = MsgBox("assault rifle.coll.xml closed")
End Sub 
although it may not have spaces

Posted: Tue May 24, 2005 6:21 pm
by Onetoomanysodas
oh, i've just been adding Print #1 to the beginning but thanks :P

Posted: Tue May 24, 2005 6:31 pm
by Phenomena
or you could put it all one one line :P

Code: Select all

Private Sub create_Click()

Dim intMsg As String
Dim StudentName As String

Open "d:\0000\XML\assault rifle.coll.xml" For Output As #1
Text = txtfile.Text
Print #1, "<?xml version="""; 1#; """?>" + txtfile  + vbCrLf + "<!--Halo Map Tools: Metadata Structure File-->" + vbCrLf  + "blah blah blah"

Close #1

intMsg = MsgBox("assault rifle.coll.xml closed")
End Sub

Posted: Tue May 24, 2005 8:43 pm
by Onetoomanysodas
but it's uber long, that version i displayed is censored :shock:

hehehe... :lol: