View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default To open workbooks: how to put behind wbk in front?

So you want to just activate the workbook (or window) that was active before
your code started?

Dim ActWkbk as workbook
set actwkbk = nothing
on error resume next
set actwkbk = activeworkbook
on error goto 0

'your code here

if actwkbk is nothing then
'nothing was active when you started
else
actwkbk.activate
end if



fred wrote:

That can be the problem.
If the workbook is already opened before my app starts I will not know its
name.
Thanks,
Fred

"Dave Peterson" wrote in message
...
If you know the name of the workbook being opened:
Workbooks("book999.xls").activate


fred wrote:

Hello,
My app opens 2 workbooks using Excel automation.
The second wrkbook is displayed in front.
How to put the first wrkbook in front?
Thanks,
Fred


--

Dave Peterson


--

Dave Peterson