LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Differences in the way a .xls file is opened

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
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
opening an excel file differences - time George Applegate[_2_] Excel Discussion (Misc queries) 0 May 1st 09 05:57 PM
Close file and run macro from newly opened file Pradip Jain Excel Programming 1 April 23rd 05 11:39 PM
Is Workbook read-only because of file permission or because file is already opened? balexis Excel Programming 0 September 29th 04 02:29 PM
How set file open path to filepath of file opened with Explorer ? RandyDtg1 Excel Programming 0 May 14th 04 02:05 AM
Opening CSV file causes date differences Tom Ogilvy Excel Programming 0 August 6th 03 12:26 AM


All times are GMT +1. The time now is 03:28 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"