Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    May 2011
    Location
    Europe
    Posts
    26
    Thanks
    20
    Thanked 0 Times in 0 Posts

    How to add "Filter" and Delete columns and rows in CSV/XLS via VBScrip

    Hello.

    Could you help me.

    I have some report and I need to Open csv/xls and than:

    1. delete first row
    2. delete some columns
    3. add 3 kolumn names

    Could you help me ? (it needs to be a function)

    I now hot to do it in VBA but I don;t have idea how to to it in VBS

    I Have some code:


    Code:
    Function OK()
    
    Const ForReading = 1
    Const ForWriting = 2
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("c:\CSVFiles\Rapport.csv", ForReading)
    
    (...)
    
    objFile.Close
    
    Set objFile = objFSO.OpenTextFile("c:\CSVFiles\Text.csv", ForWriting)
    
    objFile.Write strNewContents
    objFile.Close
    
    End Function
    Could you help me ?
    Last edited by Leos; 04-13-2012 at 01:25 PM.


 

Posting Permissions

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