View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
chijanzen chijanzen is offline
external usenet poster
 
Posts: 139
Default Open Only the User Form ... or Close Everything !

Hi monir:

Private Sub Workbook_Open()
ActiveWindow.WindowState = xlMinimized
Application.Visible = False
ShowTheForm
End Sub

Private Sub btnCancel_Click()
Unload Me
ThisWorkbook.Close True
Application.Quit
End Sub


yuo can hide Excel application
Application.Visible = False

yuo can close Excel application
pplication.Quit


--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"monir" wrote:

Hello;

Workbook Book1.xls opens a user form named myUserForm.

I'm trying to show only the user form on the desktop when I open Book1.xls,
with Book1.xls minimized on the Taskbar.
And , if the Cancel button on the form is clicked, then unload the form and
close Book1.xls. That simple!

In ThisWorkbook, I have the event:

Private Sub Workbook_Open()
ActiveWindow.WindowState = xlMinimized
ShowTheForm
End Sub

On the Form, I have the Cancel button:

Private Sub btnCancel_Click()
Unload Me
ThisWorkbook.Close True
End Sub


The above procedure shows the form, with Microsoft Excel blank window in the
background, and produces a small bar at the bottom left of the screen for
Book1.xls.
Click the Cancel button on the form, and both the Form and Book1.xls close,
but the blank Excel window remains open in the background !!!!

I suppose I would not be able to edit such version of Book1.xls, but that is
fine for now!

Your suggestion(s) would be greatly appreciated.