Solved

Save Excel File as a Tab Delimited File

Posted on 2012-03-23
4
666 Views
Last Modified: 2012-04-08
How can I modify the code below to save the OutPutFileName file as a Tab Delimited File

Public Sub saveSheets(InputFileName as String,OutPutFileName as String)

  Dim xlApp As Object
  Dim xlBook As Object
  Dim xlSheet As Object
  Dim strOutputFileName

  Set xlApp = CreateObject("Excel.Application")
  Set xlBook = xlApp.Workbooks.Open(InputFileName)  ' Excel File
  For Each xlSheet In xlBook.Worksheets    
    xlSheet.SaveAs OutPutFileName   ' Needs to save as Tab Delimited File
  Next
  xlApp.Quit

End Sub
0
Comment
Question by:PhilChapmanJr
  • 2
  • 2
4 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 37758069
xlSheet.SaveAs OutPutFileName FileFormat:=xlText
0
 
LVL 2

Accepted Solution

by:
PhilChapmanJr earned 0 total points
ID: 37758211
MartinLiss
I goto the errors below

Set xlApp = CreateObject("Excel.Application")
  Set xlBook = xlApp.Workbooks.Open(InputFileName)
  For Each xlSheet In xlBook.Worksheets
    xlSheet.SaveAs OutPutFileName
    xlSheet.FileFormat = xlText


    xlSheet.SaveAs OutPutFileName  FileFormat:=xlText
    Syntax Error in VB6

    I then tried

    xlSheet.FileFormat = xlText
    xlSheet.SaveAs OutPutFileName
    Object doesn't support this property method in vb6

  Next
  xlApp.Quit
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 37758503
It looks like it's a WorkBook function


   ActiveWorkbook.SaveAs FileName:= OutPutFileName, FileFormat:=xlText
0
 
LVL 2

Author Closing Comment

by:PhilChapmanJr
ID: 37820828
Solution did not work and expert provided no follup up
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now