I have an application created on Excel file with macros. It needs to be compatible with all Excel versions starting from 2007, both PC and MAC.
I have problem with pictures on MAC 2016. Whenever I save file, close it and reopen again I can't see pictures on the sheet which was active one during saving. Do anyone know what the problem is and how to deal with it?
My end users are not experienced enough and they get panicked if they can't see proper buttons...
My solution is to change active sheet using Workbook_BeforeSave event, but on MAC 2016 version I can't get back, because Workbook_AfterSave event doesn't work at all. As you can imagine it is not very convenient for end user to change active sheet when you just want to save your work.
I will be very grateful for any suggestion.
I'm not sure whether it helps, But you can give a try
Try using Workbook_BeforeClose event.
or else try to acheive the same using your code like switching to the sheet whatever you need
Sheets("activesheet").Select
Related
I am developing an excel "application" that will be distributed to a few users, so it has a lot of macros/vba code on it. The workbook is about 2MB right now, so it's not incredibly big.
I was developing it on excel 2013, however my workstation had a problem and I had to work on it from a computer with excel 2010 for about a week. Problem is, when I came back to excel 2013, whenever I try to save the workbook(on excel 2013) it immediatly stops responding. When the program closes, excel is never able to recover anything and says the file is corrupted. The problem simply does not occur on excel 2010, where everything works perfecly and I can save it OK.
Does anyone have any idea what might be causing this? I have tried removing a few sheets and saving the workbook afterwards, to test if a specific sheet was corrupted/causing problems, but even after I remove all the sheets from my woorkbook (and just leave a new blank sheet on it) it still freezes when I try saving.
It's important to note that the workbook in question uses a lot of excel features, meaning it has conditional formatting, defined names, activeX controls, shapes, formulas etc.
Well, I did what Ralph suggested and created a new excel file, then copied everything from the old workbook to the new one. Now it works fine. Apparently that was my only way out, the file was probably corrupted in some way.
I wrote a macro that consolidates two files into one new file on excel 2007. I sent it to someone who tried to run it on his excel 2010 and he received the error in the Title of this question. We have tried to
make sure he had the Solver addin activated and a reference to it checked
pasted this in the immediate window application.run "solver.xlam!auto_open"
I tried to disable the Solver addin on my end, save and resend to him
make sure macros were enabled
The solver addin isn't even necessary for this program, as far as I can tell. I should mention that the macro works great on my excel 2007.
Thoughts?
SOLVED: The strangest thing happened. When the workbook got emailed the button the macro was originally assigned to got changed to solver.xlam. All I had to do was instruct him to reassign the button to my macro. How odd is that?! Curious if anyone else has experienced anything like that.
I am using Excel 2007 (32Bit) on a Windows 7 64Bit machine.
I have a large Workbook with 12 sheets and 18 VBA modules.
All of my subroutines run flawlessly but one is causing the following issue:
The macro itself runs from start to finish successfully just as specified. After running the macro successfully, the workbook crashes, when I try to save it. It also crashes when AutoSave tries to save the workbook. The workbook does not crash when I simply close it.
By crashing, I mean that I get the message "Microsoft Office Excel has stopped working".
In the Windows Event Viewer I have identified the error message 0xc0000005.
In the folder where the workbook is saved, I find the temporary files that Excel creates when saving a workbook (named something like 9BB7B000).
I have tried to repair Excel in the Programs and Features part of the Control Panel but it has not worked. Furthermore no Add-Ins are enabled.
I suspected that the code module of the problem-causing macro was too large (90KB) so I split it up into two modules smaller than 64KB. However, the problem remains.
I would appreciate any help on this issue. I would like to get around reconstructing the workbook manually, if possible, as that would mean an enormous effort.
Thank you very much in advance.
Jochen
I had the same issue some time ago and carried out a research to identify the issue to no avail.
I noticed that it worked fine on workstations with better procs and more ram.
However the only way for me to proceed was to create a new workbook a one-by-one copy each worksheet from the old workbook and see which one is causing the issue. If the macro is causing the error then try to add a "sleep" command between loops so that the Excel file regains control and can execute and awaiting events/commands.
The post was 9 months ago, could you fix it?
What does that specific macro do? Because there are several solutions to this problem.
It seems that a certain "action" in your macro takes too long.
You can search for that specific action and us application.wait to slow your macro down. If this doesn't work, you'll have to find a way to reduce the "workload". But to do that, i'll need to take a look at your code.
Turn off the AutoSave function in Excel Options
I am using Excel 2010 and am having difficulty with one old workbook created in Excel 2003. Lots of symptoms to report!
No other workbooks are giving me this problem. This problem file usually causes "MS Excel - (workbook name.xls) [Compatibility Mode] (Not responding) and a blank screen apart from the task bar and this Excel message on a single line across the top of the screen. Waiting doesn't solve the problem. If I close Excel and choose the "Close program" option, it sometimes shows me the file as I remember it for a couple of seconds, then the program closes. Re-opening the file just gives the same behaviour again. During the first few seconds of loading, I can see the message "Contacting server for information" at the bottom of the Excel screen.
In Task Manager I can find EXCEL.EXE *32 running. I'm using Windows 7 Pro 64 bit.
This is a file I use regularly in projects as a specialised calculator, and so I re-copy it each time and save it to save the calculation records in the project file. I've found that versions of the workbook created even several years ago and have given no trouble until now all suffer this problem, so it looks like a problem with Excel 2010. This is the first time I've tried to open these files since migrating from a Win XP computer running Excel 2003.
Please can anyone help me to open the file and to resolve the problem?
Thanks
There might be a calculation or a marcro activated on start up that messes things up.
Try the following:
Open the Excel application, with a blank workbook. Set calculation to manual. Now look up your Macro settings and set these to "disable with notifications".
With these things set, open your misbehaving workbook again and see what happens now. Dont let the macros (if any) start yet! Open the VBA Editor window and check for a script in Workbook called Workbook_Open. If that is present check its content or put a break in and debug it.
Let us know what you find, if any.
UPDATE:
It sounds like there is a database link to an external source that is trying to refresh on startup but isnt working correctly (anymore). I now remember likewise behaviour when I had an Excel workbook with tons of SQL queries in it that (in case of showing a complete table or view by applying SELECT * FROM ...) could overlap other data and that would create autoshutdowns for me. Change the option in the Trust Center for External Content to Disable when you open this workbook and let us know!
I have a client with the same issue. The problem was resolved by removing all the logo's (Images) from the sheet. It appears that the logo contains a link to some web site. I copied the logo into paint and copied it back.
Problem Solved!
It appears that an object placed in the sheet can have its own links embedded in it???
I hope this helps!
I'm trying to get a simple VBA function to run in an excel (.xlsm) worksheet.
I created this function:
Function abc()
abc = 2
End Function
in Module2, and it worked.
But after I copied the spreadsheet to another system, it now just shows "#name" as if it can't find it. The function shows up on the available list of functions however.
This makes me think there is some kind of setting I need to enable, but I've enabled whatever I was prompted for. Any ideas?
I should've known it was in the trust center:
http://office.microsoft.com/en-us/excel-help/change-macro-security-settings-in-excel-HP010096919.aspx
Basically, hit the ball and poke around until you find "trust" and "enable macros" and select the least secure options.
And then close and re-open the spreadsheet.
I think we may need more information. What version of Excel are you using? Is it different from the destination system version?
You'll want to make sure that Module2 was in the Workbook you copied into the other system. Excel 2007 stores macros on a personal workbook by default sometimes so you'll need to check the the code is actually inside of the .xlsm file.
If you're still stuck and need a quick fix just copy the code text into the new system's Excel workbook directly without making a .xlsm file (create new module in the other system then paste).
If you would like to learn how to put together add-ins you can get started here or here.