Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The CurDir() is different depending on how you open excel.
open from dbl click file to launch excel.. (looking at C:\Documents and Settings\MyDocuments\Sub1\Sub2 and dbl clicking a file in the sub2 directory) X=CurDir() shows X having the value "C:\Documents and Settings\MyDocuments" open from the "open file" button inside excel... same file ... same directory... X=CurDir() shows X having the value "C:\Documents and Settings\MyDocuments\Sub1\Sub2" Is there some setting to make these 2 different methods of opening a file return the same CurDir() ? Or what is the best way to make sure the entire path is used? -- Regards, John "John Keith" wrote: I put this code in various places in the macro... " WBS = Workbooks.Count" Testing the value right after each assigment (with dbl-click xls file to open) WBS starts out at 1 (only main "scenario.xls" is open) workbook.add WBS = 2 .saveas and call it "newblankwb.xls" WBS still 2 .close WBS=1 .open again... WBS=2 and both scenario and newblank are open Workbooks.Open Filename:="AxisLog.xls", UpdateLinks:=0 wont open... hmm WBS=2 still. and later on I try to close the active sheet (which is supposed to be AxisLog.xls... thats why the paste is in the wrong sheet!) <F5 zoomed to end and the pastes were in error (only the scenario book open) CLosed Scenario with out updating.. clicked file open and reopened it. Put a break point after the open for AxisLog... same exact sytax and now the Workbooks.Open Filename:="AxisLog.xls", UpdateLinks:=0 works perfectly ?!? AxisLog.xls was and hasbeen in the same directory as the scenario.xls I am opening. It is a template file I copy 3 sheet tabs from. it is used to generate the first copy into the newblankwb.xls file. (so the 28 rows being copied down has nothing to do with the real issue) What would cause that open to not work? (time to look up file status checking) -- Regards, John "Datasort" wrote: John, I am having a problem understanding the source and destination of the copy process. What is the error you receive when you try this? Have you tried to see if both workbooks are open in the app. It might be that when you double click on the file name then you are launching a new instance of Excel In the imediate window try this command ... it should return 2 or more ?workbooks.Count Can you then see both workbooks Workbook(1).name and workbook(2).name Regards, Stewart Rogers |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
opening an excel file differences - time | Excel Discussion (Misc queries) | |||
Close file and run macro from newly opened file | Excel Programming | |||
Is Workbook read-only because of file permission or because file is already opened? | Excel Programming | |||
How set file open path to filepath of file opened with Explorer ? | Excel Programming | |||
Opening CSV file causes date differences | Excel Programming |