Results 1 to 6 of 6

Thread: creating csv file at runtime

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    13

    creating csv file at runtime

    I was just enquiring if anybody know how to create csv files in excel at run time. I have a feeling it's just a matter of open up an excel object and then 'saving as' a csv file. Im not sure though so if any one can help it would be much appreciated.

    Just remembered. I would also like to know how to append an attatchment to an outlook message object.

    Thanks again

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    You just want to create a comma delimeted file when an app loads is it ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    13
    yeah, when the form loads up i need to create a csv file and populate it. Im just not sure what syntax to use with the "Saveas" method of the worksheet object. See i've created a new instance of excel and am just going to try and save as csv file.

    I would also like to know the syntax to append an attatchment to an outlook mail object.

    Any help would e much appreciated.

  4. #4
    Fanatic Member steve65's Avatar
    Join Date
    Jun 2000
    Posts
    610
    Do you need to do this in VB or in Excel using VBA?

    I would think VB would be easier because you can just open a file for output and then save each line of the CVS with a print statement.

    If you need to do this in Excel turn the macro recorder on and then do a couple of operations you want to do in your program and then save as CVS file, then take a look at the macro that was recorded.
    This space for rent...

  5. #5
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Yeah as steve said, all you do is open up the file for output and print to it and put commas between the fields
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  6. #6
    New Member
    Join Date
    Nov 2001
    Location
    I'm gone like cocaine under Whitney's mirror
    Posts
    2
    ' -- Tell the browser the data is a Comma Separated Values List (CSV)
    response.ContentType="application/csv"
    ' -- Tell the browser to associate a file name with the data
    Response.AddHeader "Content-Disposition", "filename=anytext.csv;"

    Then use response.write to fill a cell, writing a comma to indicate to jump to the next column. Use response.write vbnewline to move to the next row.


    Allow myself to introduce...myself.

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