Solved

Reformat excel file from VB6 Program

Posted on 2004-10-27
203 Views
Last Modified: 2010-05-02
Look, I don't even know if this is possible but I really need to be able to have a VB6 program somehow take an excel file and save it as a csv(comma delimited file).  I have a very simple form with a file dialog that populates a textbox with the filename, including the path, and an execute button.  I need for the user to be able to select the file in the file dialog and then press the execute button and have the file saved as a csv.  It can give the new file the same name every time.  There is almost certainly a way to do this, even if it means going around the world to accomplish it.  My users need a very simple approach or it won't get done.

Thanks
0
Question by:BLWedge
    2 Comments
     
    LVL 48

    Accepted Solution

    by:
    0
     
    LVL 4

    Assisted Solution

    by:ChenChen

    If you just want to open an existing excel file and save it to  csv format, try this:

    'add excel object into your project references

    dim xlapp
    dim xlwbk as workbook

    set xlapp=createobject("excel.application")
    set xlwbk=xlapp.workbooks.open(EXCEL_FILE)
    xslwbk.saveas CSV_FILE, FileFormat:=xlCSV, CreateBackup:=False

    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    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…
    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    931 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

    16 Experts available now in Live!

    Get 1:1 Help Now