View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default One button to open and re-select

Hi
I already posted a solution for this :-)
Have you tried it?

Try a code like the following (assigned to ONE button)

...
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
....

-----Original Message-----
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...

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 don't
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\ToPBark\PI\aPM\PMP.xls"

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