Results 1 to 2 of 2

Thread: Text into Columns in Excel using console application

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    8

    Text into Columns in Excel using console application

    I have imported a .txt file to excel but I want to turn the text into columns. Using the Excel interface I would do that like this: Data->Text to Columns etc. Any ideas on how to do that using visual basic commands? Thank you in advance.

    Code:
    Imports System.Diagnostics
    
    Module Module1
    
        Sub Main()
            Dim p As New Process()
            p.StartInfo = New ProcessStartInfo("excel.exe", "C:\text.txt")
            p.Start()
        End Sub
    
    End Module

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Text into Columns in Excel using console application

    If you want to be able to automate the UI then don't use Process.Start to start the application. You need to create an Excel application object in your code so that you can access the API. Start by reading up on Excel automation and then you can find the specific members to use to invoke the function you want.

    https://www.google.com.au/search?q=v...CcHDmAX8ioDwCg
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width