Userform.load Excel invisible one for the vba experts !

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

Userform.load Excel invisible one for the vba experts !

Postby Fixador » Thu Jul 15, 2010 7:26 pm

Currently - on opening - I open a userform & make the Excel.Application invisible.

This i find is handy - but there is a downside - quite frequently at some point in the day - my ( now ) minimised userform - vanishes from the screen - and the program stops running ( i can tell it has stopped as the Q2 triggers are not getting fired in GrussBA ).

Task manager shows several Excel are running - but it is not until the end the day before i get the program to miracleously re-appear ( - why does it re-appear ? not a clue - something to do with shutting everything down )

Strikes me as there could be several issues here ....... so, question - instead of having Excel invisible on open - now, minimize it on open - and keep the Userform open & visible

However, whenever i have done this - the Userform vanishes as well

All ideas gratefully accepted ...

getting to be at wits end on this ! aggghhh !
Fixador
 
Posts: 322
Joined: Mon Apr 23, 2007 9:24 am

Postby osknows » Thu Jul 15, 2010 10:12 pm

Hi Fixador,

Not sure why the code would stop running? Have you referenced all worksheet read/writes to specific workbooks, Eg With Thisworkbook.Sheets...?

In terms of the userform disappearing... It might be something to do with the 'ShowModal' property of the userform. If the showmodal property is true Excel cannot be accessed until the form is closed.

and/or it could be your method of hiding/unhiding the userform. A userform can be hidden/unhidden or loaded/unloaded. I think unloading a userform removes the userform from memory so any variables/code within the userform could be lost.

This example shows different ways of managing userforms and the effect it as on the parent application http://www.mediafire.com/?emqnncmztkyga3m

It might be something different but hard to tell without examples

Os
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby Fixador » Thu Jul 15, 2010 10:49 pm

Hi Osknows,

Im fairly confident that my code is referenced ok - it has being checked - so that would be 2 of us missing something !

what I have is in ThisWorkbook is:-

Code: Select all
Private Sub Workbook_Open()
UserForm1.Show (False)


which tackles the modal issue

Then in Userform1:-

Code: Select all
Private Sub CommandButton2_Click() 'view Excel
    'UserForm1.Hide
    Application.Visible = True
End Sub


I have disabled Userform1.hide - as i found that - if I recovered it from being "hidden" from the workbook - it would re-intialise - there's a puzzle !

Now into Sheet1

Code: Select all
Private Sub CommandButton4_Click()
    UserForm1.Show (False)
    Application.Visible = False
End Sub


I'll take a look at your mediafire file

cheers
Fixador
 
Posts: 322
Joined: Mon Apr 23, 2007 9:24 am

Postby osknows » Thu Jul 15, 2010 11:17 pm

Your code works fine for me?
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby osknows » Thu Jul 15, 2010 11:18 pm

Are you running mutiple instances of excel?
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby Fixador » Fri Jul 16, 2010 8:06 am

Hi Osknows - you work later than me !

- yes - running multiple instances - never had any problems like this until started using forms a few weeks ago.... strewth have i said something like a tautology there !

Just started looking through yr xls.... you got it - form visible, with Excel minimised !
Fixador
 
Posts: 322
Joined: Mon Apr 23, 2007 9:24 am

Postby Fixador » Fri Jul 16, 2010 9:01 am

Hide Excel2 > UnHide Excel2 achieves minimisation - but keeps the form visible.

Looking at the code :-

Code: Select all
Private Sub CommandButton7_Click()
Unload UserForm1
Application.WindowState = xlMinimized
UserForm1.Show 0
End Sub


Unload Userform1 - damn - if i did this - I would expect UserForm1 to re-intialise - ie, I lose all of the inputted values on the form

musing..... could I substuite Userform1.Hide ? one to try

Code: Select all
Private Sub CommandButton7_Click()
UserForm1.Hide
Application.WindowState = xlMinimized
UserForm1.Show 0
End Sub


Can a Textbox retain a changed value ???........

Now to add an intialisation - that inserts a value into the textbox

Start workbook : Intial value shows

Click on Hide Excel

Click on Unhide Excel

textbox value remains the same

...now the crunch test

change the value in the textbox

now click Hide Excel

Unhide Excel - and bingo - textbox has retained the new value

Well thats a new trick - which i desperately needed ! 2 problems solved

the test xls is at

http://www.mediafire.com/?hyur39qii8knh3r
Fixador
 
Posts: 322
Joined: Mon Apr 23, 2007 9:24 am

Postby Fixador » Fri Jul 16, 2010 10:29 am

nearly there ......
Intially form open, but Excel does not show in taskbar - no thats not true - it appears in the taskbar - then vanishes ....

Userform cmd button: to "show Excel" - and Excel appears visisble and in taskbar

From Workbook cmd :to "hide Excel" - form appears - and Excel stays in taskbar as minimized

phew !

needs a bit of tweaking to get Excel to stay visible in the taskbar at start up - probably got a .visible = false lurking in the userform1 code !

thanks Osknows
Fixador
 
Posts: 322
Joined: Mon Apr 23, 2007 9:24 am


Return to Discussion

Who is online

Users browsing this forum: No registered users and 34 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.