+ Reply to Thread
Results 1 to 8 of 8

Refreshing an imported text file

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Refreshing an imported text file

    I am importing a text file using Data -> From Text. I would like to be able to refresh this using the code
    Please Login or Register  to view this content.
    This which once worked, no longer does. If I right click on the table in Excel the Refresh option is greyed out.
    The only change I am aware of is that I have unchecked Prompt for File Name in DataRange Properties, which was available to me before the problem started.
    Will this have caused my problem? If it has how do I allow my users to download the text file without knowing its name (which they will not)?

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Refreshing an imported text file

    Data->From Text. Won't be able to refresh if relative address of the text file changes (unless you use prompt to specify file).

    Depending on company network set up, text file may reside at different drive letter designation for each user (ex. some may have it mapped to S-drive, while other have it on Z-drive etc) even if it's located in network drive.

    There are several ways to work around this, but it will depend on your intended audience (internal, external), versions of Excel used by users etc.

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Refreshing an imported text file

    The textfile that I am copying resides on a network drive. The excel file that I am using will reside on each of the users own networked machines. As far as I am aware all the users machines have their networks configured the same way. I always use this technique of storing and retrieving data in text files and it works well on my network. I am developing the current application on my networked machine using Excel 2010. The other networked machines will use either 2010 or 2007.( Again these machines are currently running 3 applications which I have built, all refreshing textfiles using the same sub routine above.).
    I would very much like to know of the sort of thing I could do to work round the problem.
    John

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Refreshing an imported text file

    How often is this connection refreshed?

  5. #5
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Refreshing an imported text file

    CK76
    Once as the application is opened. Usually the users keep it open on their machine during the working day. So I would say between 1 and 3 times
    John

  6. #6
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Refreshing an imported text file

    AS a work round of my problem I have decided to connect to the text file instead of refreshing. To do this I use the following code found by running a Macro
    Please Login or Register  to view this content.
    This leads to another problem which is that a new connection is added to the list of connections each time the Macro is used. I assume that I will be able to delete the connection in the code above, but I have not been able to fins a way of doing this. Can anyone help please.
    John

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Refreshing an imported text file

    As far as I know, the refresh option will not be disabled simply by the absence of the file- you will just receive an error when you try to refresh. The refresh button would, however, be disabled if you had deleted the connection which the query uses.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Refreshing an imported text file

    This leads to another problem which is...
    I'd suggest using ADO to read/import from text file. You can find extensive documentation in links below. If you encounter problem in implementation let me know.
    MSDN article that has some examples of working with ADO
    https://msdn.microsoft.com/en-us/library/ms974559.aspx

    Good tutorial with explanation of common mistakes
    http://www.xtremevbtalk.com/tutors-c...cel-files.html

+ 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. HELP PLEASE!! MASSIVE amounts of data needing to be imported from one text file.
    By Paulehutson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2015, 01:50 PM
  2. How to Clean an Imported Text file with VBA
    By zaska in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-17-2013, 07:07 AM
  3. add imported text file name above imported data
    By tompie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2009, 08:18 AM
  4. Refreshing a Table imported from Excel
    By NBVC in forum Access Tables & Databases
    Replies: 5
    Last Post: 01-06-2009, 04:07 PM
  5. Refreshing Imported Data
    By jtwork in forum Excel General
    Replies: 4
    Last Post: 02-01-2007, 05:55 AM
  6. Replies: 2
    Last Post: 02-02-2006, 04:15 PM
  7. [SOLVED] can I display the file name of the imported text file in another c
    By John-G in forum Excel General
    Replies: 0
    Last Post: 05-13-2005, 01:06 PM

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