Re: Appending text files
From: Rick Rothstein (rickNOSPAMnews_at_NOSPAMcomcast.net)
Date: 06/09/04
- Next message: MikeD: "Re: Newbie runtime error problem"
- Previous message: Bob Butler: "Re: how many no. of controls can be inserted in a form of vb"
- In reply to: Björn Holmgren: "Re: Appending text files"
- Next in thread: Björn Holmgren: "Re: Appending text files"
- Reply: Björn Holmgren: "Re: Appending text files"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 9 Jun 2004 10:04:21 -0400
> > Does anyone know how to append text files using VB? I am outputting
three
> text files from SQL Server using DTS. The first file contains header
data,
> the second contains the base data and the third contains trailer data.
I
> need to be able to append the header data at the beginning of the base
data
> and the trailed data on the end. I've never appended text files
before and
> would really appreciate some help. I am using VB6 and SQL Server 2000
on an
> NT4 box.
>
> Here's one way:
>
> When you call the JoinFiles subroutine you must pass it an array of
files to
> join. The array can contain one or more filenames. You also pass it
the name
> of an output file which will receive the joined contents.
>
> Example:
>
> Call JoinFiles(Array("File1.txt", "File2.txt", "File3.txt"),
"File123.txt")
>
> (joins File1.txt, File2.txt and File3.txt, outputs result to
File123.txt)
>
> '----------
> ' Joins two or more files
> ' Note: First parameter expected to be an array of filenames
> Sub JoinFiles(sFiles As Variant, sFileNew As String)
I probably would have declared your Sub this way instead
Sub JoinFiles(sFileNew As String, ParamArray sFiles() As Variant)
and dispensed with the need to (remember to) pass an Array function into
the Sub. (Nothing in your code needs to be changed to accommodate this
suggestion.)
Rick - MVP
- Next message: MikeD: "Re: Newbie runtime error problem"
- Previous message: Bob Butler: "Re: how many no. of controls can be inserted in a form of vb"
- In reply to: Björn Holmgren: "Re: Appending text files"
- Next in thread: Björn Holmgren: "Re: Appending text files"
- Reply: Björn Holmgren: "Re: Appending text files"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|