Aug 24, 2003 #1 apascual Programmer Jun 17, 2003 11 PH help! how will i write a csv file format using visual basic? data will be coming form sql tables. can anyone send me a source code? tnx in advance.
help! how will i write a csv file format using visual basic? data will be coming form sql tables. can anyone send me a source code? tnx in advance.
Aug 25, 2003 #2 bryanbayfield Technical User Aug 10, 2001 345 EU Either use the filesystemobject (common to all ms office object models) or use open filename for [append|output] as #filenumber. Try digging around in teh VBA help files. Upvote 0 Downvote
Either use the filesystemobject (common to all ms office object models) or use open filename for [append|output] as #filenumber. Try digging around in teh VBA help files.
Aug 26, 2003 #5 terzaghi Programmer Aug 25, 2003 49 IT Hi, try this Sub CreateAfile() Dim str As String Set fs = CreateObject("Scripting.FileSystemObject" Set a = fs.CreateTextFile("c:\testfile.txt", True) str = Worksheets("Sheet1".Cells(6, 3).Value & ", " & Worksheets("Sheet1".Cells(6, 4).Value a.WriteLine (str) a.Close End Sub I've taken this from the help of VBA. hope this will help A Upvote 0 Downvote
Hi, try this Sub CreateAfile() Dim str As String Set fs = CreateObject("Scripting.FileSystemObject" Set a = fs.CreateTextFile("c:\testfile.txt", True) str = Worksheets("Sheet1".Cells(6, 3).Value & ", " & Worksheets("Sheet1".Cells(6, 4).Value a.WriteLine (str) a.Close End Sub I've taken this from the help of VBA. hope this will help A
Aug 26, 2003 #6 ETID Programmer Jul 6, 2001 1,867 US saves the active sheet....you can splice variables into the path and file name to make it more dynamic. ActiveWorkbook.SaveAs Filename:= _ "C:\my_path\file_name.csv", FileFormat:=xlCSV, _ CreateBackup:=False Upvote 0 Downvote
saves the active sheet....you can splice variables into the path and file name to make it more dynamic. ActiveWorkbook.SaveAs Filename:= _ "C:\my_path\file_name.csv", FileFormat:=xlCSV, _ CreateBackup:=False