Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Dec 2009
    Location
    Palm Coast, Florida
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB 2010 advice requested

    I do not have a programming background but I have had moderate success with cobbling programs to suit my needs and I am still continuing to learn. I am undertaking a project where I have created a working program in VBA via Excel but now want to contain the main workings in a VB executable then eventually output to Excel. I would like to get suggestions as the to best method to accompish my needs. I have 5 .csv files that contain bits of information that I need to extract to a single file. The only common factor is that the first column in each file contains a unique identifier. Some columns in each of the files need to be eliminated. The first column in each of the files are not identical but do contain some of the identical identifiers. I've read about reading the file into an array and I've read about reading the file into a dataset but I do not have the experience to know which is the most efficient method or if either will get me to my goal.

    I am not asking for code....just for a push in the right direction.

    Thanks in advance.

  2. #2
    Star Lounger
    Join Date
    Mar 2010
    Location
    Winston-Salem, NC USA
    Posts
    65
    Thanks
    12
    Thanked 4 Times in 4 Posts
    It all depends on what you need to do with the data after the import. Arrays are very efficient in .NET and if all you need to do is "spin" through the array to arrive at some result then great. A Dataset will allow you to derive a DataTable and a subsequent DataView which will allow you to sort or filter the data. If sorting and filtering are beneficial for you to achieve the result then that's the way I would go plus you could use a DataGridView to "preview" your data. There is a handy csv to DataAdapter function to quickly get the data into a dataset.
    Last edited by Bender; 2013-03-14 at 07:12. Reason: small correction
    Do your part!!! Report SPAM to http://www.spamcop.net/

  3. #3
    New Lounger
    Join Date
    Dec 2009
    Location
    Palm Coast, Florida
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, Bender for your response. As it worked out I chose to go the way of Excel Automation. With all that I was able to read neither working with datagridview, datasets, or arrays was going to allow me to edit the data in the way that I need to. Maybe to better state my intent.....I have text files that are generated when I perform a regen operation in our Hicom 9006 via a telnet session. There are five files that I create individually for each of our three pbx's a total of fifteen reports. Each file needs to be edited before they can be converted into .csv file format. Once I have all of the files converted I have to further edit the files to delete the unnecessary columns or rows. After I have completed this editing I now need to combine the data into a single worksheet. As I had mentioned in my previous post I had already accomplished what I wanted completely in vba but the code was sloppy and a little cumbersome. I was hoping that there might be a more efficient means of accomplishing my end goals but it turns out that per my limited knowledge in programming I have opted to program it in vb .net. So far I'm rather pleased with what I have coded to this point. I've been able to recode some of my old code using few lines of code to get to the same end. I still have so much to learn and at times the information available is overwhelming and sometimes miss leading. I have yet to grasp "namespaces" which is why there seems to be several ways to write the same basic lines of code.

    Thanks again.

  4. #4
    2 Star Lounger
    Join Date
    Dec 2009
    Location
    Dallas, Texas, USA
    Posts
    113
    Thanks
    3
    Thanked 6 Times in 6 Posts
    On the surface, it sounds to me like you have chosen correctly to stick with VBA for this application. Please pardon the pun, but Excel excels at the kinds of manipulations that you describe. Why program the bits that Excel already handles?

    That said, it might be possible to use a bit more VBA to automate some of that manual formatting, especially the bits about eliminating unwanted columns.
    David Gray, Chief Wizard
    WizardWrx
    Irving, Texas, USA

    WizardWrx Web - Technical Articles and Free Software
    You are more important than any technology we may employ.

  5. #5
    New Lounger
    Join Date
    May 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    follow the link

    http://vb.net-informations.com/excel..._tutorials.htm

    It will solve most of your VBA problems.

    winston.

  6. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by winstongel View Post
    follow the link

    http://vb.net-informations.com/excel..._tutorials.htm

    It will solve most of your VBA problems.

    winston.
    The is nothing in that link having anything to do with VBA. VB.NET is not VBA.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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