Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minimise workbook but display userform?

Status
Not open for further replies.

N1GHTEYES

Technical User
Jun 18, 2004
771
0
0
GB
I'm trying to set up an Excel workbook so that, when it starts, it does so minimised, but showing a userform. What actually happens however is that the workbook is minimised (and it's task-bar icon is flashing) but the userform is not visible until the user clicks on the task-bar icon.

Here is my code:
Code:
Dim oldstate As Long
On Error Resume Next
oldstate = Application.WindowState
Load ufrm_ConvertImage
ufrm_ConvertImage.setstate oldstate
ufrm_ConvertImage.SetParent Application
Application.WindowState = xlMinimized
ufrm_ConvertImage.Show

When the user clciks the task-bar icon, Excel stays minimised and the userform displays. This is the state I want it to be in, but I don't want the user to have to click the taskbar icon to get there.

Can anyone suggest what I'm doing wrong?

Thanks,
Tony
 
It may be obvious, but I suppose I should have said that the above code is in the Workbook_Open event.

I guess I also ought to point out that the userform in question is ufrm_convertimage and, finally, that ufrm_convertimage.setstate is a method of the userform used to capture the starting windowstate of the excel application so as to be able to restore it later if required.

Tony
 
Just a suggestion, but instead of minimizing the workbook resize it to the dimensions of the userform, then for the userform, turn off all boardering. Not exactly pretty, but should work.


OCD, it’s not obsessive if you can control it…
 
Thanks for the idea, I will give it a try if I can't figure out what I'm doing wrong. It seems it should be so simple to display a userform, in code, while keeping the parent workbook minimised, that I'm sure I must be doing somthing stupid.

I was hoping that somebody might know why I was getting this problem and if there was a simple fix for it. So far nobody has suggested one though, and if the folks here can't see a solution, then I begin to believe there may not be one.

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top