From: Walter Briscoe on
This is an excerpt from some working code:
With Workbooks("stations.xls").Sheets("Sheet1")
Here = ActiveWorkbook.Name: .Activate ' See what is going on
StationRow = Application.Match(EndStation, .Range("$A$1:$A$298"), 0)
s = .Cells(StationRow, OfficeHoursCol).Formula
s = Evaluate(GetSub(s, "^=HYPERLINK.(.*), .Hours..$", "$1"))
TxURL s

When I comment the "Here = ..." line, the "s = Evaluate..." does not
work as intended.
When "Sheet1" is active "A40" is a reference to a cell in "Sheet1"; when
inactive, it is a reference to whatever other sheet happens to be
active.

As it happens, the fix was easy. I commented the two "s =" lines, and
inserted
s = "http://www.journeyplanner.org/imr/XSLT_SOI_REQUEST?" & _
"language=en&itdLPxx_agent=ticketOffice&type=stop&id=" & _
.Cells(StationRow, JPcodesCol)

I can probably do better when I think about it. At the moment, I am
happy to have a fix.

I would appreciate light on similar problems. I suspect it is a problem,
already known to gurus here. I have been assuming that the sequence
Here = ActiveWorkbook.Name: .Activate ' See what is going on
<some code>
Windows(Here).Activate

is equivalent to
<some code>
--
Walter Briscoe
From: sali on
"Walter Briscoe" <wbriscoe(a)nospam.demon.co.uk> je napisao u poruci
interesnoj grupi:CWm+wKr2$7AMFwa5(a)freenetname.co.uk...
> This is an excerpt from some working code:
> With Workbooks("stations.xls").Sheets("Sheet1")
> Here = ActiveWorkbook.Name: .Activate ' See what is going on
>
> When I comment the "Here = ..." line, the "s = Evaluate..." does not
> work as intended.

after 'name' there is a colon ':', is it intentional?
colon ':' is a command separattor, so on that line you have actualy two
commands, '.activate' being the second
it is a bad practice, since program flow is not so clear