Quantcast
Channel: Fórum ASP
Viewing all articles
Browse latest Browse all 1214

erro no FSO

$
0
0

Olá, estou precisando gravar em um arquivo, no entanto, após abrir com o fso, busco uma função, e dentro dela é que está o comando WriteLine, mas não funciona. Como contornar?

 

Função que grava o arquivo:

Sub GeraArquivo(prefixo, nomearquivo)


	On Error Resume Next
	sFolder = ""
	sFn = (prefixo, & "_" & nomearquivo & ".txt"
	Set fso = Server.Createobject("Scripting.FileSystemObject")
	bWriteHeader = Not fso.FileExists(Server.MapPath(sFolder & sFn))
	Set ArquivoTxt = fso.OpenTextFile(Server.MapPath(sFolder & sFn), 8, True)
	If bWriteHeader Then
		call geraCabecalho
	End If
		Call geraLinhas


	ArquivoTxt.Close
	Set ArquivoTxt  = Nothing
	Set fso = Nothing
End Sub

call GeraArquivo("cidade", "contratos")

 

Função que puxa os dados:

 

	Public Sub geraLinhas()
		Dim html
		html = 	"001"					
		html = html & "9999"				
		html = html & "9"				
		html = html & preenche(9, true)			
		html = html & ""				
		html = html & ""				
		html = html & ""				
		html = html & preenche(205, true)		
	        'aqui era para escrever no arquivo que já está aberto pela funcao GeraArquivos
		ArquivoTxt.WriteLine(html)
	End Sub

A função cria o arquivo (caso ele não exista), mas fica em branco, a função não consegue popular o arquivo txt...

 

Se alguem tiver dicas, agradeço!

 


Viewing all articles
Browse latest Browse all 1214

Trending Articles