Link to home
Start Free TrialLog in
Avatar of ahammar
ahammarFlag for United States of America

asked on

Styles in style list

Scenerio: I open up a workbook that has had some styles added (Format,styles,add). I open up a completely new instance of Excel so now I have 2 instances open, the saved workbook and a new workbook each in thier own instance of excel. I copy one cell from the workbook that has had styles added to the style list and paste it into the other new instance of excel that has only default styles. All the added styles from the saved workbook are now in the new workbook also. OK fine. I close them both (without saving).
Now I do the exact same thing, but I open up a different saved workbook then before (also with styles added to the style list) I copy and paste any number of cells I choose (from 1 to all of them), only this time the styles in the style list do not copy over. Some of the workbooks copy the styles from the style list over(same workbooks everytime) and some don't(same workbooks every time). I have done this many many times trying to figure out why certain workbooks do this, and others don't. It stands to reason that there is something different between the ones that do it, and the ones that don't. I have spent hours on this and I realize this is a very difficult question(or atleast I think so), but maybe someone out there has some idea what could be different about them to cause this. I'll send more thank yous then youv'e ever got if you can answer this one.
E-mail me if you want at:  ahammar@micron.net
Sincerely,
Albert
ASKER CERTIFIED SOLUTION
Avatar of argmyster
argmyster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ahammar

ASKER

You are very good! You are right about the virus. The workbooks where the styles copy over were at one time infected with the Sgv macro virus, and the ones that don't copy the styles have never been infected. But the problem is, that the workbooks that were infected are completely cleaned of all viruses now(including all the files on the computer itself), and all the excess styles have been removed and have been that way for quite some time. But there is still something different about them somehow to allow them to copy any styles that have been added to the previously infected workbook over to a new workbook just by copying and pasting one of it's cells into a new workbook, when other workbooks don't. I am quite familiar with the Sgv and Car viruses now, ( I even have copies of the macros saved in notepad)  and I am sure that they are completely gone (except for whetever remnant or effect is left to cause this.), but I am going to go back through the detailed information you sent me and make sure there isn't something I missed.
Probably most people would be satisfied once they had got rid of the virus, but I have other reasons for needing to copy and paste cells or sheets from one workbook to a new one, and I can't have the styles go to. I don't know if you have witnessed the Sgv virus, but it does other things other then just add styles to the style list, it also adds numerous sheets with thier properties set to xlVeryhidden so you can't see them unless you go into the visual basic editor. I've written numerous different macros to delete all the styles it adds (it would take a person a few 8 hour days to delete them all, it takes the computer about 2 hours in some cases). I am close but I can't write the perfect macro until I figure this out and I have over 400 workbooks to clean of styles and added sheets.
Sorry this is so long. I appreciate very much you taking the time to answer my question.
I have numerous postings, and this is the only one I've got an answer to so far.
Thank you Very, Very much!!!
Albert
ahammar@micron.net
Avatar of argmyster
argmyster

I have some more for you Albert.  I understand you wanting to get all your files cleaned up and in some cases the only hope you have is to reconstruct the file.  Also, you could write a macro that would clean out all the creepy styles, but that would be more work and debugging than you may willing to tackle.

With this in mind, go get this great utility from Microsoft.  

Microsoft Excel 97 File Recovery Macro

http://premium.microsoft.com/download/msdn/samples/Recover.exe

Add this to your collection of utilities.

You can try to reconstruct the file programmatically.

Here is a little advice…when you reconstruct the file, don't try to reconstruct the formatting.

Good luck with your files.  I know you will appreciate the Utility.

Argmyster…

Another little titbit for you
This little addin will also remove some viruses.

XL: How to Use the Virus Search Add-in (WE1280)               [excel]
ID: Q150990 http://support.microsoft.com/support/kb/articles/Q150/9/90.asp

Argmyster...
Avatar of ahammar

ASKER

Argmyster,
Thank you again!!
I have just down loaded the file recover utility. As soon as I get done writing this I am going to try it.
I just finished up a macro to delete all the styles (except for about 70 of them that won't delete) which is where my next macro comes in. It opens up the infected workbook, copies all it's pages into itself(The Excel workbook that my macro is in), then closes the infected workbook, deletes the link it creates, deletes the one page out of itself and then saves itself with a different name. Then the 70 styles that weren't deleted before are now gone and so are all the extra hidden sheets of the infected workbook and I have an exact copy of the original. I was then able to put the two macros together into one and create a fairly nice little program that completely replicates the original. I don't know why both steps have to be done but they do. But like you said, it took a lot of debugging and trial and error, but I've already done it now. I wish I could of talked to you sooner because I have a feeling I'm gonna like this recovery utility unless it is the Cleaner.xla which I have already tried (it works fairly well, but not perfect), but I don't think it is. Regardless, I am so very appreciative of you taking time to respond and I double and triple thank you for this idea on the Recovery utility.
I have graded your response as excellent because you deserve it.
If you want to chat some more, (I'de like to send more thanks) my e-mail is:
ahammar@micron.net
Thank you again Very, Very much.
Albert
ps. I see you know quite a bit about Excel, because your also right about the formatting part. I think the macro I wrote will copy the formatting, but I have'nt checked it out that close yet so I'm not sure. I tried to get it to and again it took a lot of trial and error and debugging.
Well, I going to check out the file recovery macro now
Thanks again!!!!!!!!!!!!!!!
See ya