create a text file in access

A

alecarnero

I want to create a file with .pag final with this code, but the code must
take the name from the variable nomearq,

Private Sub Comando5_Click()
Dim fs As Variant
Dim a As Variant
Dim nomearq As String
nomearq = "arquivo1"
Set fs = CreateObject("scripting.FileSystemObject")
Set a = fs.createtextfile("c:\pager\nomearq.pag", True)
a.writeline ("idpag")
a.Close
End Sub


i always have the same output a file named nomearq.pag , when the right
output must be arquivo1.pag, what is wrong in this code ???

Thanks in advance
Alejandro carnero
 
D

Dirk Goldgar

alecarnero said:
I want to create a file with .pag final with this code, but the code
must take the name from the variable nomearq,

Private Sub Comando5_Click()
Dim fs As Variant
Dim a As Variant
Dim nomearq As String
nomearq = "arquivo1"
Set fs = CreateObject("scripting.FileSystemObject")
Set a = fs.createtextfile("c:\pager\nomearq.pag", True)
a.writeline ("idpag")
a.Close
End Sub


i always have the same output a file named nomearq.pag , when the
right output must be arquivo1.pag, what is wrong in this code ???

Thanks in advance
Alejandro carnero

Instead of this:
Set a = fs.createtextfile("c:\pager\nomearq.pag", True)

use this:

Set a = fs.createtextfile("c:\pager\" & nomearq & ".pag", True)
 
T

TC

PLEASE DON'T MULTI-POST. That is, sending the same message seperately, to
several different newsgroups.

Instead, CROSS-POST. That means adding all the relevent nesgroup names to a
single post. Then, people reading one of the groups that you posted to, will
see the ansers that you received in other groups. That stops them wasting
their time by answering a question that has already been answered!

TC
 
A

alecarnero

Sorry
TC said:
PLEASE DON'T MULTI-POST. That is, sending the same message seperately, to
several different newsgroups.

Instead, CROSS-POST. That means adding all the relevent nesgroup names to a
single post. Then, people reading one of the groups that you posted to, will
see the ansers that you received in other groups. That stops them wasting
their time by answering a question that has already been answered!

TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top