Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default File Properties Location retrieve to refresh background query?

Hi! I have several CSV files that I am exporting from a server, and I bundle
them with a pre-formatted XLS that has an Auto-Open macro that brings them
all into the spreadsheets in the appropriate location. The whole package is
zipped up and emailed to my users in a batch process. I'd like them to unzip
these files to their location of choice and just click on the XLS, but I
don't know the name of the path that they're going to use when they unzip
them, I just assume they will all go into the same folder or desktop
location, the File.XLS, File1.CSV, File2.CSV, etc., all together.

My problem is that when the macro tries to execute the background query
refreshes, it uses an embedded hardcode to the path that I last used when I
saved the file. I have tried stripping out the specifics, e.g., to leave
only the FILE1.CSV information without the path, but it doesn't work. Is
there a way that I can retrieve the File/Properties/Location information for
the XLS and use that path information, minus the file name itself, and stuff
that into my macro, appending each of the CSV file names? Thanks for your
help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default File Properties Location retrieve to refresh background query?

Hi,

Unfortunately when you double click on an xls file in Windows Explorer,
Excel opens with the its default path so you can't use CurDir to return the
path where the file/s are located.

I usually provide instructions to the user that they must open Excel first
and change to the directory where the file is located and open it from within
Excel. You then do not need the path for the other files but if you want it,
CurDir can be used to return it. However, need to append a back slash before
appending the file name.

strCurPath = CurDir & "\"

--
Regards,

OssieMac


"lireland" wrote:

Hi! I have several CSV files that I am exporting from a server, and I bundle
them with a pre-formatted XLS that has an Auto-Open macro that brings them
all into the spreadsheets in the appropriate location. The whole package is
zipped up and emailed to my users in a batch process. I'd like them to unzip
these files to their location of choice and just click on the XLS, but I
don't know the name of the path that they're going to use when they unzip
them, I just assume they will all go into the same folder or desktop
location, the File.XLS, File1.CSV, File2.CSV, etc., all together.

My problem is that when the macro tries to execute the background query
refreshes, it uses an embedded hardcode to the path that I last used when I
saved the file. I have tried stripping out the specifics, e.g., to leave
only the FILE1.CSV information without the path, but it doesn't work. Is
there a way that I can retrieve the File/Properties/Location information for
the XLS and use that path information, minus the file name itself, and stuff
that into my macro, appending each of the CSV file names? Thanks for your
help!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Query SQL File Location Richard Excel Discussion (Misc queries) 3 February 2nd 07 08:13 PM
MS Query File Location Richard Excel Discussion (Misc queries) 0 January 31st 07 12:52 AM
ms query file location busypgmr Setting up and Configuration of Excel 0 September 5th 06 09:46 PM
how to retrieve properties of a file in VBA lvcha.gouqizi Excel Programming 1 October 15th 05 10:26 PM
Link Access query to refresh an EXCEL file Dancer4u New Users to Excel 1 January 13th 05 05:24 PM


All times are GMT +1. The time now is 02:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"