is there a way to hide or minimise excel so that it isnt seen in the background, i only want the user to see the forms i have created in visual basic
any help would be appreciated
is there a way to hide or minimise excel so that it isnt seen in the background, i only want the user to see the forms i have created in visual basic
any help would be appreciated
ok thanks ill give it a go
yeah it minimized but so did the userform, it flashes on the start bar and when u click the userform displays and the workbook stays minimised, any further ideas?
Hi bigandyt,
Do you really need to hide Excel? Is this a flashing screen problem whilst you codes working?
Anyway here are 2 approaches to the problem.
You can set Application.Visible = False
or you could move Excel off of the screen area.
The following code will currently do the moving style. uncomment the lines in order to change to the visible approach
Put this code in the userform code module.
Click the userform to hide/reveal excel.
Private m_lngLeft As Long
Private m_lngTop As Long
Private m_lngWindowState As Long
Private Sub UserForm_Click()
' Hide Excel
' Application.Visible = Not Application.Visible
If (Application.Left + Application.Width) > 0 Then
' visible
m_lngLeft = Application.Left
m_lngTop = Application.Top
Application.Left = -(Application.Left + Application.Width)
Application.Top = -(Application.Top + Application.Height)
Else
Application.Left = m_lngLeft
Application.Top = m_lngTop
End If
End Sub
Private Sub UserForm_Initialize()
m_lngWindowState = Application.WindowState
Application.WindowState = xlNormal
End Sub
Private Sub UserForm_Terminate()
' Application.Visible = true
Application.WindowState = m_lngWindowState
End Sub
Display More
Trouble with both of these approaches is if anything goes wrong and your code bombs the state of excel may completely confuse and annoy the user.
Use with due care and attention!
just thought i'd message back to say thanks so much, really happy cuz now the program looks a little more professional. What you said bout setting it visible = false was spot on, i appreciate all the time given helpin me out guys,
cheers
Andy
hey
Just a follow up... if you do use Andy's approach by bumping the application off the screen, or making it visible = false, you may want to use some error handling in your code.
for example:
Don’t have an account yet? Register yourself now and be a part of our community!