473,466 Members | 1,503 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

need help writing to files

11 New Member
i have the following code in one module

Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub CreateAfile
  3.     Set fs = CreateObject("Scripting.FileSystemObject")
  4.     Set a = fs.CreateTextFile("c:\testfile.txt", True)
  5. End Sub
  6.  
  7.  
how do i use the streamwriter a.writeline in a different module

example:
Expand|Select|Wrap|Line Numbers
  1.  
  2. sub mywriter () 
  3.     a.writeline("hello")
  4. end sub
  5.  
  6.  
Apr 10 '07 #1
3 1426
MMcCarthy
14,534 Recognized Expert Moderator MVP
To write to a file you need to open the file for write access.
Expand|Select|Wrap|Line Numbers
  1. Dim frfile As Integer
  2. Dim fileName As String
  3. Dim fline As String
  4.  
  5.    fileName = "c:\testfile.txt"   
  6.    fline = "Hello"
  7.  
  8.    'open the text file to be written to
  9.    frfile = FreeFile()
  10.    Open fileName For Output Access Write As #frfile
  11.  
  12.         Print #frfile, fline
  13.  
  14.     Close #frfile
  15.  
Mary
Apr 10 '07 #2
205210864
11 New Member
thanx a million
Apr 10 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
thanx a million
You're welcome.
Apr 10 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
10
by: Neil Trigger | last post by:
Is there a way of creating a seperate text file on a server every time a form is sent? -- ¿ Trigger ? http://www.magic2k.com/ http://www.oddmap.co.uk
22
by: macAWM | last post by:
Hi list, First let me explain that my background is in Java and I am quite spoiled to its niceties (read "less ambiguous nature"). Anyway to my problems. 1. I want to write my own library for...
1
by: Rizwan | last post by:
I am writing this code for file upload in asp 3.0 on my webpage........ It is working on local system but when i want to upload an image on my website from client machine it is not working ..........
6
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
7
by: elgiei | last post by:
Good morning at all, i have to implement a server,that every n-seconds (eg. 10sec) sends to other clients,which files and directory has been deleted or modified. i build a n-tree, for each...
6
by: MGM | last post by:
Alright, so here's my issue. I have a bunch of .dbf files, about 40 or so by summer's end, I'd say. These dbf files somewhat differ from each other as far as number of columns and data is...
3
by: koutoo | last post by:
I have a code that writes to 2 seperate files. I keep getting a "list index out of range" error. The strange part is that when checking the files that I'm writing too, the script has already...
0
by: akshaycjoshi | last post by:
namespace consolepractice { class Program { static byte asyncreadbytes; static byte asyncwritebytes; static FileStream fileS; static FileInfo file; ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.