Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am currently using a special type of modeless userform that
remains visible even when the Excel application is minimized. I load the form with a pushbutton that calls "Userform1.Show vbModeless". Additionally, this userform is defined as follows: --------------------------------------------------------------------------------- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _ ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetWindowLongA Lib "user32" _ (ByVal hWnd As Long, _ ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Const GWL_HWNDPARENT As Long = -8 ---------------------------------------------------------------------------------- Private Sub UserForm_Initialize() hWnd = FindWindow("ThunderDFrame", Me.Caption) SetWindowLongA hWnd, GWL_HWNDPARENT, 0& End Sub ---------------------------------------------------------------------------------- Since the above userform can sometimes get hidden underneath Excel in the background, I wanted to be able to bring the form into the foreground if my pushbutton is pressed again. I use the following code to (attempt) to achieve this: Sub Button1_Click() UserForm1.Visible = True ' Set visible as True will bring to foreground??? End Sub The problem is, if I attempt to run the above code in "Button1_Click()", I get the following compile error: "Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic" Does anybody know why this error occurred??? What does it mean?? And what is the best way to bring my userform to the foreground? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Modeless Userform | Excel Programming | |||
Clicking on chart does not bring to foreground | Charts and Charting in Excel | |||
Modeless userform | New Users to Excel | |||
How do I Bring a window to the foreground? *outlook warning | Excel Programming | |||
modeless userform | Excel Programming |