LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Force use of the Default Directory

Hi All.......
I have a file I call MyMaster.xls and I want to open another file and copy a
sheet out of it into the MyMaster file. This is fine and I can do it, but
only if I declare the exact path and the filename of MyMaster to copy it to.
I would like to be able to force the macro to use the same directory that
MyMaster.xls is in, wherever that might be, and to copy the sheet into the
current " MyMaster" file, no matter how I might have renamed MyMaster....like
MyMaster2, or MyMaster3, etc.

Heres the code I'm using now, but of course it doesn't do as I want.

Sub GetQ5PlanFile()
ChDir "D:\JumpMicroCruizer122804\Special\PlanningEve nt"
Workbooks.Open FileName:= _
"D:\JumpMicroCruizer122804\Special\PlanningEvent\Q 5PLAN.XLS"
Sheets("Q5PLAN").Select
Sheets("Q5PLAN").Copy Befo=Workbooks("MyMaster.xls").Sheets(2)
Windows("Q5PLAN.XLS").Activate
ActiveWindow.Close
End Sub

Any help would be much appreciated,

Vaya con Dios,
Chuck, CABGx3


 
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
MSOffice default directory Max Setting up and Configuration of Excel 0 June 3rd 06 08:39 PM
How to force a Default sort for a validation list scott56hannah Excel Discussion (Misc queries) 0 April 18th 06 03:05 AM
How do I force an Excel macro to ask me which file and directory? Ramius Excel Discussion (Misc queries) 4 January 14th 05 03:26 PM
How to force current directory CLR Excel Programming 8 November 30th 04 01:11 AM
Set Default Directory bw Excel Programming 4 July 30th 03 11:45 PM


All times are GMT +1. The time now is 07:27 AM.

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

About Us

"It's about Microsoft Excel"