conversion from xcel sheet to CSV file using VB script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mitta
    New Member
    • Feb 2008
    • 1

    conversion from xcel sheet to CSV file using VB script

    i would like to have the VB code for converting the Excel sheet in to VB code..can any body help me..? let me know the procedure in detail..
    even if any one can have...they can pass me EXE file...
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    What do you mean by converting the Excel sheet in to VB code ?

    What are you trying to do ?

    Kindly post your code that you are working on for reference of our experts.

    Comment

    • kadghar
      Recognized Expert Top Contributor
      • Apr 2007
      • 1302

      #3
      Originally posted by debasisdas
      What do you mean by converting the Excel sheet in to VB code ?

      What are you trying to do ?

      Kindly post your code that you are working on for reference of our experts.
      LOL
      i think that was some kind of typo debasisdas ^.^ he might want to convert the sheet into a CSV, as the title says, what is simple. use the SaveAs method of the workbook object, setting the FileFormat to xlCSV, or its numeric value (that is 6)

      Workbook.SaveAs Filename:= Name, FileFormat:= xlCSV

      e.g.
      [CODE=vb]
      ActiveWorkbook. SaveAs FileName:="c:\m yTable.csv", FileFormat:=xlC SV[/CODE]
      or

      [CODE=vb]Workbooks(1).Sa veAs FileName:="c:\m yTable.csv", FileFormat:= 6[/CODE]

      Comment

      • Bum
        New Member
        • Jan 2008
        • 19

        #4
        Hi,

        You could read the excel file in, then write it out in csv (comma separated values)

        to read look at this post:

        http://www.thescripts. com/forum/thread651944.ht ml

        to write just use the

        open 'filename' for input as #1
        Write #1, variable, variable, variable
        'this writing will output into a csv.
        close(1)

        hope this helps!

        B

        Comment

        • Bum
          New Member
          • Jan 2008
          • 19

          #5
          nevermind, I like Kadgar's way better! haha

          Comment

          Working...