Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John,
As a rule I don't view attachments. So I'm responding without having viewed your macro. I'm guessing that you either have a PivotTable or QueryTable in your Excel file. The directory location of a source file is contained in two places (Connnection & CommandText). In order to change the source location of the text file you need to modify these two properties of the PT/QT. 1) PivotCaches(1).Connection = "the_new_connection_string" 2) PivotCaches(1).CommandText = "the_new_query_string" -OR- 1) QueryTables(1).Connection = "the_new_connection_string" 2) QueryTables(1).CommandText = "the_new_query_string" You will need to reference the PT/QT appropriately for your situation. Let me know if you need help here. Troy "John Garate" wrote in message ... Excel 2002, Win XP, SP-2 I created the attached macro to open a tab delimited file located in the folder C:/EMP3. It works fine. However, I've changed the folder name on the C drive to EMP4. I've edited the macro to replace the reference EMP3 to EMP4, but it does not run. It seems to hang up at the Refresh BackgroundQuert: = False statement (at least what's the line the debugger lighlights). What is the correct way to edit the macro when I change the file location? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to change a reference when the sheet change the folder? | Excel Worksheet Functions | |||
... I'd like to change the Default Folder... | Excel Discussion (Misc queries) | |||
how can i change my default working folder to a networked folder? | Excel Discussion (Misc queries) | |||
Change Default Add-in Folder | Excel Discussion (Misc queries) | |||
Change Folder Icon | Excel Programming |