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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can activex dll write to text file??

Status
Not open for further replies.

hinchdog

Programmer
Feb 14, 2001
380
0
0
US
i'm trying to make a dll that writes to a text file using the filesystemobject to be called from an asp page. but i can't get it to work. is this even doable?
 
Yes it is perfectly do-able, I have done this many times before! See below...

<%@ Language=VBScript %>

<%

Dim s, sTextFile


'create file-system-object
Set fs = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

sTextFile = &quot;testfile.txt&quot;

'create text file
Set ts = fs.CreateTextFile(sTextFile, True)

s = &quot;This is a line in a text file!&quot;

'write the line
ts.WriteLine s

'close file
ts.Close

'cleanup
Set ts = Nothing
Set fs = Nothing

%>

If it doesn't seem to be able to open the file, check your permissions in the directory you're trying to create/open it in.

Use the object browser in VB to determine the constant values for the OpenTextFile method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top