LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default change folder

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
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
How to change a reference when the sheet change the folder? WonderOlga Excel Worksheet Functions 2 January 3rd 08 09:19 PM
... I'd like to change the Default Folder... Dr. Darrell Excel Discussion (Misc queries) 4 September 11th 07 04:12 PM
how can i change my default working folder to a networked folder? wizard1154 Excel Discussion (Misc queries) 4 April 18th 07 07:29 PM
Change Default Add-in Folder compound Excel Discussion (Misc queries) 2 July 13th 05 10:25 PM
Change Folder Icon James Stephens[_2_] Excel Programming 1 May 9th 04 08:42 PM


All times are GMT +1. The time now is 09:04 AM.

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"