Consulting

Results 1 to 2 of 2

Thread: Auto Import Text file GetOpenFilename no dialog

  1. #1
    VBAX Newbie
    Joined
    Jul 2010
    Posts
    1
    Location

    Auto Import Text file GetOpenFilename no dialog

    Ok, long time reader first time poster!

    I am fairly new to VB coding so here it goes.

    I have a VB that imports VBA code into an excel workbook which then imports a text file into the excel, formats the text correctly, etc. It saves the file then closes.

    We are trying to automate this whole process.

    The client HAS to have the dang report in excel!! Not csv, excel.

    - Mainframe creates a text file

    - VB script kicks off, imports VBA code into excel macro

    - text file gets imported to excel worksheet

    - file is saved in excel format for customer to get.

    Here is my dilemma.

    We are using the GetOpenFilename command in the VBA code.

    The problem with this is a dialog box opens and someone has to actually click the file to open.

    Is there a way to get the text file automatically by specifying the file and not have the dialog box open?

    I hope this makes sense.

    I can't have the excel jut open a csv file and save as excel because of a few problems.

    1. acct numbers beginning with 0. The cell has to be formatted as a text field first.

    2. Long account numbers get changed to scientific format!

    Any help would be VERY appreciated

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If you know the file path, why not just use open the text file.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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