Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have learned more through this forum than I did on a two day course. Thanks to everyone for their help and other postings that I have found useful..."

Geography

Where in the world do Tek-Tips members come from?
shadowsanders (IS/IT--Management)
25 Jan 12 15:29
Can someone tell me exactly what to add to this code to have the column header titles appear as the first line of the csv file that is created?  Hopefully this is an easy question for a developer and any help would be greatly appreciated.

Sub Initialize
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim nbcol As Integer
    Dim k As Integer
    Dim newline As String
    Dim fileName As String
    Dim fileNum As Integer
    Dim item As NotesItem
    
    Set db = s.CurrentDatabase
    Set view = db.GetView( "Custom Export NOR" )
    nbcol = Ubound(view.Columns)
    Set doc = view.getfirstdocument
    
    
    fileName = "\\CC Charts\CustomExportNOR.csv"
    
    fileNum = Freefile()
    Open fileName For Output As fileNum
    
    k = 0
    While Not (doc Is Nothing)
        
        newline = ""
        For k = 0 To nbcol
            newline = newline + doc.ColumnValues(k)
            If k <> nbcol Then newline = newline + ","
            
        Next
        
        Print #fileNum, newline
        Set doc = view.GetNextDocument(doc)
    Wend
    
    Close fileNum
    
    
End Sub

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close