Workbook not visible...
Posted on 2004-09-10
After I quit a vb 6 form, and click on a xl file to open it, excel object (menu, border, etc.) show up; but the workbook itself is not visible (it is transparent, you can still see the desktop thrugh border where the workbook supposed to show).
I want to include a code to in QueryUnload of vb form to handle this situation (to close all excel applicatiion hidden or visible). Now I am trying to use:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA"(ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
Public Sub RemoveAllExcelFiles()
On Error Resume Next
While CBool(FindWindow("XLMAIN",0)) \
Set m_app = GetObject(,"Ecel.Application") |
'If m_app.visible=False Then |
m_app.Quit > When I remove 'exit sub line, it will loop While CBool...Wend
'End If | forever, if I include this line... this is the cause of the proplem above
'exit sub | (maybe?)