How do I deactivivate a workbook?

  • Thread starter Thread starter Marc
  • Start date Start date
M

Marc

Hello all,

I can't figure out how to deactivate or minimize a workbook. Without
getting too specific, basically I am intercepting the 'close' command
until I exit the program and just want to deactivate the workbook the
user was trying to close.

I can't find any commands that will accomplish this. The workbook has
an activate command (wb.Activate) but no deactivate. How can I do
this?

Thanks ahead of time,
Marc
 
So it forces you to have an active workbook. I didn't know that. I guess
you can always default to the first workbook in the list.

But is there any way to simply minimize the workbook? I think that would
be the easiest thing to do.

And I can't close it because then it severs my connection to the COM
server. If there's a way to reconnect to the workbook after it's closed,
I'm not aware of it.
 
Marc,

I ran the macro recorder and got this (with a little tweak to change from
Activewindow to the window for Book1). It minimizes Book1 but Book 1 is
still the active workbook.

Sub Macro1()
Windows("Book1").WindowState = xlMinimized
End Sub

hth,

Doug
 
Yes, the xlMinimized was what I was looking for.

I'm not a VB guy, and I'm trying to integrate COM with Python, so it's a
little difficult sometimes to find the magic command. As a result, I
wasn't aware of the VB record function either, and that's mighty helpful
also.

Many thanks,
Marc
 
Back
Top