PDA

View Full Version : Something odd has happened with an "Always on Top" window.



Incognitus
09-25-2012, 10:34 AM
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. :banghead:


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.

:help

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!

Kenneth Hobs
09-25-2012, 11:25 AM
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.

Incognitus
09-25-2012, 11:32 AM
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?

Kenneth Hobs
09-25-2012, 11:35 AM
I would work on a backup copy and try: https://office.microsoft.com/en-us/excel-help/repairing-corrupted-files-in-excel-HA001034656.aspx

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

snb
09-25-2012, 01:12 PM
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.

Incognitus
09-25-2012, 02:11 PM
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.

Paul_Hossler
09-25-2012, 04:47 PM
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

Incognitus
09-26-2012, 10:40 AM
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.

snb
09-26-2012, 02:38 PM
Not for me......