View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default If open, go to, else open

Yeah...that's what I came up with. I don't have any
trouble opening or activating or selecting...it's just
getting it to happen with the same button that's causing
me grief.
Anyone else have any ideas?
Thank you,
Gee...

-----Original Message-----
Hi
the code I provided should only open the workbook if it

is not already
opened.
Sorry, there's no simple if then statement for this

--
Regards
Frank Kabel
Frankfurt, Germany


Gee wrote:
It opened it, but I got a message that is was "already
open and reopening will cause any changes you made to be
discarded..."

I thought there was a simple if, then statement I could
use.
-----Original Message-----
Hi
one way

dim wbk as workbook
on error resume next
set wbk = workbooks("PMP.xls")
on error goto 0
if wbk is nothing then
Workbooks.Open Filename:= _
"\\bo-10\ToP\ToP Bark\PI\aPM\PMP.xls"
set wbk=activeworkbook
end if
wbk.activate

--
Regards
Frank Kabel
Frankfurt, Germany


Gee... wrote:
I have the following for some buttons.
To open I have:
Workbooks.Open Filename:=
"\\bo-10\ToP\ToP Bark\PI\aPM\PMP.xls"

I then have another button to go back to that sheet if
it's already open.
Windows("PMP.xls").Activate

I need to know what the "IF" statement is so I dont'

have
to have 2 buttons.
How do I say:
If "\\bo-10\ToP\ToP Bark\PI\aPM\PMP.xls" is open,

activate
PMP.xls, else open "\\bo-10\ToP\ToP

Bark\PI\aPM\PMP.xls"

I keep trying to do it and getting it wrong.
Help?
Thank you,
Gee
.


.