+ Reply to Thread
Results 1 to 3 of 3

Refresh query from text source without manually selecting text file each time

Hybrid View

ALN1991 Refresh query from text... 06-28-2013, 12:32 AM
isskint Re: Refresh query from text... 06-28-2013, 02:29 AM
ALN1991 Re: Refresh query from text... 06-28-2013, 01:13 PM
  1. #1
    Registered User
    Join Date
    06-21-2013
    Location
    Wiltshire, UK
    MS-Off Ver
    365 Version 2210 Build 16.0.15726.20070
    Posts
    72

    Re: Refresh query from text source without manually selecting text file each time

    How is the data in the text file separated? Assuming it to be comma delimited (CSV) you can open it as a workbook - Application.Workbooks.Open (FULLPATH & FILENAME). So to open ThisData.csv in folder DownLoadData on drive K it would be Application.Workbooks.Open("K:\DownLoadData\ThisData.csv"). This will open your text file and make it accessible to you. I would suggest you create a variable to hold your textfile as your code will refer to it a lot (you may already do this any way). EG

    Dim wkbDownLoad as Workbook
    
    Application.Workbooks.Open("K:\DownLoadData\ThisData.csv")
    
    Set wkbDownLoad = ActiveWorkbook
    Isskint, i get satisfaction out of helping others

  2. #2
    Registered User
    Join Date
    06-27-2013
    Location
    New Hampshire, USA
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Refresh query from text source without manually selecting text file each time

    I have a workbook consisting of 3 sheets. Using the workbook command opens the CSV file as a workbook in place of my current workbook rather than opening it in place of the current sheet I'm on. The other problem is that this just opens the data exactly as is, and doesn't preseve any of the import preferences/settings I established when manually doing it through a query. At worst I need to be able to open it in a sheet within the current workbook, but at best I just need a way to do the refresh automatically without having to manually specify the file each time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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