Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateTextFile: permission denied

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
US
I get:

Microsoft VBScript runtime (0x800A0046)
Permission denied

with this line:

Set objTextStream = objFileSystemObject.CreateTextFile(filename & ".csv", 2, True)

What do I need to change?

[conehead]
 
make sure the IUSR_Machine name has all the permissions...

also make sure that you have read and write permissions to the folder/directory

-DNG
 
thanks... I am running into an issue - how do I tell where it is trying to create the file? The code is:

Code:
filename="export" & CLng(Now)
Set objTextStream = objFileSystemObject.CreateTextFile(filename & ".csv", 2, True)
objTextStream.Write(ResultsString)

I would assume it is trying to put the file in the same folder as this page, but that does not seem to be the case? How can I tell where it is trying to create the file so I can check permissions?

[conehead]
 
yes if you did not specify any path then it will try to create the file in the same folder as your script page...why dont u go ahead and create a variable with the path and then try to create the file to see if that works...

the problem here is with the permissions and not with the code...

-DNG
 
we'll here's the problem I am running into then (to take a step back)

I change the following code:

Code:
filename="export" & CLng(Now)
Set objTextStream = objFileSystemObject.CreateTextFile(filename & ".csv", 2, True)
objTextStream.Write(ResultsString)

to

Code:
filename="excel_files/export" & CLng(Now)
Set objTextStream = objFileSystemObject.CreateTextFile(filename & ".csv", 2, True)
objTextStream.Write(ResultsString)

and created a folder on the same level as the page and now I get a "path not found" error... could it be trying to create the page somewhere else?

[conehead]
 
nope...try using the path like...Server.Mappath(./excel_files/export)

-DNg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top