PDA

View Full Version : make the Application active



metev
11-09-2007, 02:18 AM
Hi guys,

My Problem is not so big but still I want to solve it.I have designed/programmed an application in Excel.Now when I click the .xls File I want only the application to be active not the Worksheets.I have achieved that by hiding the woksheets with Application.Workbooks.Application.Visible = False
it works fine but when I close the application and start the .xls File again then appears a message that the .xls is already opened.As far as I understand the problem , when I click the close-button it does NOT close the Worksheets.If anyone can help me it would be great.Thanks in advance!

Cheers
Valeri

Bob Phillips
11-09-2007, 05:08 AM
How do you click a close button when the applictaion is not visible?

metev
11-09-2007, 06:17 AM
I meant actually:


Application.Workbooks.Parent.Visible = False

Bob Phillips
11-09-2007, 06:31 AM
That is still the application is it not? So my question still stands.

metev
11-09-2007, 10:26 AM
no its not the application its the .xls File.Try it!

Bob Phillips
11-09-2007, 10:48 AM
I did. The parent of Workbooks is the application.

Zack Barresse
11-09-2007, 11:08 AM
That is what your first post says as well, Application.Workbooks.Application.Visible = False is still the application. Do you have multiple instances running concurrently? Perhaps a little more detail on your part as to what you are doing here step-by-step. Screenshots and code posts help a lot. ;)

dewanna
11-09-2007, 11:40 AM
Hi Metev,:hi:

Try this

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Workbooks.Application.Visible = True
For Each wb In Application.Workbooks
wb.Save
Next wb
Application.Quit
End Sub
:)

metev
11-09-2007, 12:14 PM
please dont consider the first post!
I have an applicaton that I have been designing for the past 1 year.My problem is when I open the .xls file both the worksheets and UserForm appear.Now I want only to activate the Userform just to make sure that nobody will change my worksheets.So what I did is :

Wrote this piece of code.And It did work.When I open the .xls File only the UserForm appears and the Sheets are invisible.When I close the UF it doesnt automaticaly close the whole .xls File.I was wondering is there any way when I close the UF also to close the whole File.

Thats all!

there is the screenshot!When I dont write ..Application.Workbooks.Parent.Visible = False
the Sheets are also visible!file:///C:/Dokumente%20und%20Einstellungen/ivo/Desktop/withcode.bmp

metev
11-09-2007, 12:15 PM
actually can you see the screenshot?:dunno

Zack Barresse
11-09-2007, 12:30 PM
Check out the userforms queryclose event.

Bob Phillips
11-09-2007, 12:35 PM
That is because you have hidden the application, and when you close the userform, you still have an invisible application open.

You need to make the application visible inthe form QueryClose routine, and also close any applicable workbooks.

BTW, did YOU try it?