Consulting

Results 1 to 9 of 9

Thread: Something odd has happened with an "Always on Top" window.

  1. #1

    Question Something odd has happened with an "Always on Top" window.

    Before I begin, I'd like to apologize for not being able to post the Workbook concerned, or post the exact code I've used. Unfortunately, it is stored on a closed internal network without any means of removing it from that network --- and I can't even bring full note in or out of the building.


    Anyway, I have a spreadsheet which has a modeless Userform (Let's call it "n") popping up after an autoshape is pressed. It has an initialization event that sets it always on top (using a pretty standard "Always on Top" function - I think I got it straight from this site's knowledge base) and then minimizes the application window behind it, thus leaving this form to be the only item on screen. After this, all controlsources for text boxes are set.

    When this userform is closed with the X button, the application window maximises.

    This worked all fine and dandy up until my last update this afternoon. I added another userform that would appear when a button was pressed on "n" (let's call this one "Y" - y not?). I put in a delay, which resolved the issue I was having with the spreadsheet crashing at this point. At this point, "n" was closed. I then programmically set up "Y"'s textbox control sources.

    The issue is not with Y.

    Since adding "Y" however, "n" refuses to minimize the application window. Additionally, when I press the original autoshape, I noted that it would do three things - the exact same things each time.

    First, nothing would happen.
    Second, Form "n" would open, but without minimizing the application window and gaining an always on top property.
    Third, the spreadsheet would white out and become unrecoverable.

    Each time without fail the same thing happens. I put in a msgbox in various places to find out where the problem might be.

    I put one in the call event in the autoshape before and after the request to open the userform: The above three events still happened, except the first time the autoshape was clicked, the msgbox appeared. It never appeared again.

    I put it before the API function to make the window always on top - same as above, except the message box appeared the second time only.

    I put it after the API function - same thing again, except this time, it didn't show up at all.



    I'm at my wit's end. This is supposed to go live as of tomorrow morning, and it all appeared to be working smoothly when I initially tested it. I don't know what could have changed that would have effected this. Even if nobody is able to provide an answer, any suggestions or pointers of things to look at would be a great help.

    And again, I am so sorry that I can't provide a workbook, but hopefully the above will be enough to go on.

    Thanks very much for even the smallest suggestion!

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    What version of Windows? XPPro was just updated recently. If some DLL files were changed, that might cause a problem with the API routines.

    Could be a file corruption issue but I doubt it.

  3. #3
    Quote Originally Posted by Kenneth Hobs
    What version of Windows? XPPro was just updated recently. If some DLL files were changed, that might cause a problem with the API routines.

    Could be a file corruption issue but I doubt it.
    It worked in the morning - no updates took place. Stopped working in the afternoon.

    If it was a file corruption issue, how best do I recover?

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    I would work on a backup copy and try: https://office.microsoft.com/en-us/e...001034656.aspx

    Of course a reboot is a good thing to try first.

  5. #5
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    By why don't you post a mock up workbook containing the essentials you are talking about ?
    Otherwise my mind will get corrupted a well.

  6. #6
    Quote Originally Posted by snb
    By why don't you post a mock up workbook containing the essentials you are talking about ?
    Otherwise my mind will get corrupted a well.
    Alas, I don't have a copy of Excel at home either else I most certainly would. I'll try to get some more extensive notes back tomorrow.

  7. #7
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Have you re-started the computer since the problem first occured?

    Re-starting fixes a lot of those sort of 'what happened' problems.

    Another thing I've had good luck with is with Rob Bovey's code cleaner

    http://www.appspro.com/Utilities/CodeCleaner.htm

    Paul

  8. #8
    Well, I rebuilt the spreadsheet from backup and found what appeared to cause this problem.

    In a completely different macro, I added the instruction to maximize the window. The macro would only be run from the second spreadsheet and had no reason to affect anything I was doing! Weird.




    Instead, I have a completely different issue. I've copied the userform from another worksheet, as I said above.... but this new workbook now only works for me. For everyone else it crashes.

  9. #9
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    Not for me......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •