Keep Excel Minimize While Using UserForm

250 views
Skip to first unread message

JesterXR

unread,
Jul 11, 2006, 9:10:03 AM7/11/06
to excel vba
I have code that will bring up a UserForm and then minimize Excel (So
that it runs in the background) while the user inputs his or her's data
into the UserForm, it also prevents the user from using the task bar to
open the workbook. My problem is that if the user already has an Excel
workbook open when he or she runs this workbook, the minimize will
still function, but now it is possible for the user to open up the
Excel workbook by using the task bar, I don't really know why this
happens and I've tried alot to keep it from happening, so I figured one
of you might have tried this before. Here is the code I use to minimize
Excel and keep it from being opened from the task bar.

Private Sub UserForm_Initialize()

Application.WindowState = xlMinimized
Workbooks("Enter Comments").Sheets("Main").Select
DeptBox.Enabled = True
DeptBox.SetFocus

End Sub

ducky801

unread,
Jul 14, 2006, 10:52:01 AM7/14/06
to excel vba
Jester,

I think you should look into opening a new insance of excel (that will
only hold the workbook in question). You can have code running in this
instance, while the user works in the other instance. Here is some
code to get you pointed in the right direction. If you need
clarification, just ask. Hope this helps

Ducky

_______________________Code Below______________________

Dim XLapp As Excel.Application
Dim xlbook As Excel.Workbook

Set XLapp = New Excel.Application
XLapp.Visible = True
Set xlbook = XLapp.Workbooks.Open("C:\Documents and Settings\areesex\My
Documents\Output\Output_EmpData.xls ")

Set XLapp = Nothing
Set xlbook = Nothing

Reply all
Reply to author
Forward
0 new messages