+ Reply to Thread
Results 1 to 6 of 6

Import spectiality delimited text file

  1. #1
    Registered User
    Join Date
    08-27-2019
    Location
    Alabama, USA
    MS-Off Ver
    365, 2016, 2010, 2007
    Posts
    57

    Import spectiality delimited text file

    Hello guys,

    Several months back I was working on a spreadsheet to help with my tasks at work (while learning VBA in the process) and was mid project when circumstances caused me to put that project on hold. Now, 4-ish months later, I am trying to pick it back up and am having trouble figuring out where to go (and recalling the little I had started to learn about VBA in general).

    I have some working VBA code that currently imports several .s2p files (specialty delimited text files) and copies them to a new workbook, each file in its own sheet.

    The next step I need to accomplish is to modify what I have to make a version that only allows one file to be imported.

    Below is a copy of my working "Private Sub multiple_s2p_new_sheet()" code as well as my non-functional "Private Sub single_s2p_this_sheet()" code as well as a few example .s2p files (special text files from data collection).

    Any help or advice is appreciated.

    In the next step I will need to solve, I will need to make a version of this code (both the single and multiple) that imports the files into new sheets within the current workbook instead of making them in a new workbook; advice on that step would also help me out. Thanks in advance!

    Link to zip file containing several .s2p sample files.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Import spectiality delimited text file

    Why do you need a Single file version? Couldn't you run the Multiple file version and only select one file when prompted?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    08-27-2019
    Location
    Alabama, USA
    MS-Off Ver
    365, 2016, 2010, 2007
    Posts
    57

    Re: Import spectiality delimited text file

    Because the end goal is to give this to the technicians at work, and I am trying to make it as dummy proof as possible.

    The overall process will be to upload several files of raw data (A) and upload a single calibration file (B) and divide each point of each of the data files, by each point of the calibration file (A0[1,1]/B[1,1].......A255[1601,255]/B[1601,255]).

    There will also be a need to perform an equation on each point of a data file, but I'll figure that out when I get to it.

    Thanks for your help and time,
    Trent Spencer - KM4YTU

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Import spectiality delimited text file

    Quote Originally Posted by spencer_time View Post
    and upload a single calibration file (B) and divide each point of each of the data files, by each point of the calibration file (A0[1,1]/B[1,1].......A255[1601,255]/B[1601,255]).
    So on the single file version, you don't want a file prompt? You want to load one file with a known path and filename? If not, then I still do not understand.

    This opens one specific file without prompt. Change the file name and path to suit.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 03-03-2020 at 07:31 PM.

  5. #5
    Registered User
    Join Date
    08-27-2019
    Location
    Alabama, USA
    MS-Off Ver
    365, 2016, 2010, 2007
    Posts
    57

    Re: Import spectiality delimited text file

    Thank you for reply and time once again AlphaFrog.

    I'm sorry if I was unclear, but I still need a dialog box to choose the file with, I just need it to be impossible to choose more than one file.

    I will however save this version of the code, as I tested it and it is functional, and I can see potentially using it in the future.

    I will see if I can modify your version to suit my needs while I wait on a response.

    Thank you again for your time and help.

    Regards,
    Trent Spencer - KM4YTU

  6. #6
    Registered User
    Join Date
    08-27-2019
    Location
    Alabama, USA
    MS-Off Ver
    365, 2016, 2010, 2007
    Posts
    57

    Re: Import spectiality delimited text file

    Well....I ended up getting something that would sort of work....making the hardcoded file be defined with a form text box. It's still not what I was thinking of...a dialog box to choose the file (but limited to one file) that would make it as easy to use as possible on the 3 people who would be using it.

    I changed the strFileToOpen variable from your example to the following in my modified version:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 18
    Last Post: 04-11-2019, 02:24 PM
  2. Non delimited File import
    By andywt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2016, 01:54 PM
  3. Import a ~ Delimited Text File into Excel
    By vrooom247 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 12-02-2014, 07:58 AM
  4. Import tab-delimited file
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-29-2010, 04:01 AM
  5. Import space delimited text file into excel
    By vijay2482 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2009, 12:29 PM
  6. How do I import a pipe delimited file with text that contains a few commas?
    By john928 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2005, 09:53 PM
  7. [SOLVED] I have a Comma delimited text file how do I import in to excel an.
    By trevord in forum Excel General
    Replies: 1
    Last Post: 02-03-2005, 08:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1