Results 1 to 2 of 2

Thread: Multiple sheets using CSV

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Location
    India
    Posts
    2

    Post Multiple sheets using CSV

    Hi,

    I am using the following code in VB6 to generate a CSV file that opens in MS EXCEL :

    CODE :

    Dim printLINE as String
    Dim ctr as Integer
    Open "c:\File1.CSV" For Output As #1
    For ctr = 0 To 20
    printLINE = printLINE & ctr & ","
    next ctr
    Print #1, printLINE

    This generates a csv file by the name File1.csv with only one sheet by the name File1.

    My question is that how can i have more that one sheet e.g. File1 & File2 within the same csv file File1.CSV?

    Does any body have any idea ?

    Arun

  2. #2
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202
    csv files only support single sheets, so would think you would need to have seperate files for each.

    Code:
    Dim printLINE as String 
    Dim ctr as Integer
    Dim intFileCtr as integer
    
    for intFileCtr = 1 to MaxFileNumber
    Open "c:\File" & intFileCtr & ".CSV" For Output As #intFileCtr 
    For ctr = 0 To 20
    printLINE = printLINE & ctr & ","
    next ctr
    Print #intFileCtr , printLINE
    next intFileCtr
    seems to work ok.

    HTH

    Brian
    if you fail to plan, you plan to fail

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width