W
Walter Briscoe
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>
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>