View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
John Keith[_2_] John Keith[_2_] is offline
external usenet poster
 
Posts: 175
Default Differences in the way a .xls file is opened


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