I have a macro which works fine on my computer when I click its button but it does not work on different computers.
All the macros on that excel file are not working when clicking on the button.
However, I have a macro working before saving. That means that when I try to save, another macro works properly. (that macro pop up an input message, but is not relevant now). So it seems that macros are not working only when you call them by a click...
The version of Excel is the same one and I enabled the macro when asked.
It is not a problem of the code because even if I create a new simple macro on that file from the different PC (such as:
msgbox("hello")
) it is still not responding.
I had a problem with that excel file in the past and I had to manually delete all the *.exd extensions in my computer. However once I deleted those extensions, the file worked well.
I believe that the excel file is considered corrupted by other computers and they do not enable the macro. This is just my impression but I cannot get why the macro is working when saving and not working when clicking.
Do you have any idea to solve the problem?
I had issues like that myself both with macros and with Excel workbook doing some really funny stuff (like formulas not calculating properly, or functions not working as expected etc) and I did not find any other solution then copying the content of the file and pasting into a newly created file.
In each case this resolved my problem.
It suggests that my files somehow got corrupted and the only solution was to save the contents and delete the files.
Exporting the .frm and .frx files from VBEditor (Modules and Forms) worked fine for me.
Have you tried this yourself?
This may be too simple a suggestion, but have you checked the security settings in Excel? The other computers may be set to a higher security setting that disables all macros without notifying the user.
https://support.office.com/en-US/Article/Enable-or-disable-macros-in-Office-documents-7b4fdd2e-174f-47e2-9611-9efe4f860b12?ui=en-US
Related
I was working the whole day with my excel file, that contains a few macros, then, all of sudden, the macros are not there. I have tried everything, but I neither can see the codes, nor create new macros. I did went check to see if there was a disabled add-in, but there isn't. What can I do to solve this issue??
I wrote a macro that now is causing issues with MS Word. I can only open the document in safe mode and cannot figure out how to delete the macro from safe mode. I don't have access to any of the features in safe mode and the macro isn't even showing up. I tried changing the Trust Center settings but none of those options make a difference. Unfortunately I was very dumb and made it a macro on all documents so I can't open any documents without going into safe mode. help!
To be more specific, I believe the code that broke my MS Word was a OnError GoTo ErrorHandler where I tell it to skip to the next if there is an error. I am working on converting equations to a professional format and some of them don't have the right syntax for the conversion so for now I wanted it to ignore those equations and convert the next equation. That is the only change I have made recently that could be the problem.
An additional edit: the macro is coded to run on open. It was running fine before I added the ErrorHandler. I'm sure this is also a huge part of the problem, but a simple solution may not be the right fix since it automatically runs when I open the document. I can't access anything in safe mode.
If you are talking about the "Normal" document in the project explorer, resetting it is easy.
Simply navigate to %AppData%\Microsoft\Templates and either delete or rename the Normal.docm file. Once you reopen Word it will regenerate a brand new file automatically - one that contains no code.
You created an AutoOpen macro which only fires when a document is opened. Presumably this macro is stored in your Normal template.
When you first start Word the macro should not run as you are not opening a document. If Word doesn’t automatically create a new blank document you can safely do so. You will then be able to access and edit the macro you created.
I have an issue with my Excel workbook. I have code both in modules and embedded in the sheet.
Until recently, everything was working fine but suddenly the code embedded in the sheet does not work.
I have a sub routine for right clicked cells. This used to create a drop-down menu of its own rather than the standard right click menu but recently it stopped working. I have tried deleting the entire code and simply putting msgbox("Test"), but it still doesn't work.
Macros are enabled as this is the interesting thing ... if I right click the sheet tab and copy it ... the new version works absolutely fine. It is as if the original sheet has become corrupt.
This is further evidenced by when I try to delete the original sheet manually (right click tab and delete).
This causes Excel to crash.
I can delete any other sheet no problems.
However, a colleague of mine opened the workbook and it works fine for him without having to duplicate the sheet.
When it first happened I did the duplicate fix then renamed the original to "OBSOLETE". Not a pretty workaround, but worked nevertheless.
It has now happened again, however, and I am reluctant to keep patching it in this way.
If I try to address the sheet using VBA from another sheet:
Code in sheet 2 ("Slave"): msgbox(sheets("Master").cells(1,1).value)
it gives the following error:
Run-time error 32809: Application-defined or object-defined error
I have tried addressing it as sheet1.cells instead of sheets("Master").cells as well and this gives the same error.
Changing the code to point to Sheet3 works fine. It is literally just this sheet causing problems.
I tried 'open and repair' on the document too.
I have read around extensively and tried the deletion of .exd files etc. No luck.
Any thoughts? It seems independent of code - more a specific issue with this workbook and its sheet which over time becomes 'corrupt' but only for some machines/users.
There is also a command button in the sheet. This also does not work (clicking it just does nothing). If I go into the VBA editor and manually activate the sub-routine, I get the following error:
Compile error:
Object library invalid or contains references to object definitions that could not be found.
Again, this still happens even if I strip the code right down to a simple msgbox operation.
Any thoughts would be appreciated. Thanks
Hi i am having the same issue running code that populates combo boxes on my sheet. It seems that the sheet index is being deleted so the workbook o longer 'sees' the sheet you are trying to reference.
A simple workaround i found is to resave the workbook with a different name and it should work fine but this is not ideal when it is running on a regular basis. It does however allow you to recover the original workbook after it has been corrupted on the other machine.
It seems that some security updates made by microsoft in December 2014 have resulted in issues running sheets across the old and new machines. They are aware of the issue and are working to resolve it. This blog explains the issues and work arounds:
http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2014/12/11/forms-controls-stop-working-after-december-2014-updates-.aspx
Their solution provided on the above blog requires all users to have this update and then to delete all .exd files from the temp folder that are related to the issue and then recompile the code (this still requires all machines to have the new update).
Another option (the one I will be taking until they resolve the issue) is to roll back the problem machines to a pre Dec version prior to making the update.
Hope that helps!
I have an Excel 2010 file (.xlsm) that contains code in a few modules including ThisWorkbook. The ThisWorkbook module contains a few Event procedures, including a _SheetActivate event.
I have a button on one sheet that, when clicked, activates a different sheet.
Today after working on some code in one of the regular modules, I clicked the button and got a
Run time error '-2147417848 (80010108)'
Method 'Activate' of object '_Worksheet' failed.
Any attempt to activate a different sheet (manually or programmatically) crashes the Application.
After some extensive research, all I found was this page which gives further information regarding the error:
-2147417848 (80010108): The object invoked has disconnected from its clients.
Resolving the error isn't so much of a concern to me because I don't need that particular event anymore. However, I do need to figure out why Excel keeps crashing. I tried to delete the code, but Excel crashed. So I tried commenting the code out, but Excel still crashed. Alas, everything I've tried has resulted in a crash. This leads me to believe that something must be corrupt in the script within that module (the code in other modules seems to work fine, but none of the other procedures activate a sheet).
I've read that an option would be to copy everything (including code) over to a new workbook, but I'd like to avoid that if possible as that would require copying more than the current sheet...but I can't copy the other sheets without Excel crashing. Does anyone have any ideas on how I could remove/delete the code from ThisWorkbook?
After too many crashes to count, I was finally able to resolve the issue.
First I copied the code (Ctrl + C) from ThisWorkbook that I wanted to be able to use later and pasted it into a blank notebook file. Then I did as Patrick suggested and exported the regular modules.
At this point, I tried programmatically removing the code, but Excel crashed again. Then it dawned on me that I didn't have to delete the code manually or programmatically; I just saved the file as an .xlsx document which by design removes the code.
From there I closed the file, opened it back up, and imported the .bas files I'd exported earlier. The last step before I saved the file in .xlsm format was to paste the copied code from the first step back into ThisWorkbook.
Everything works like a charm now. Thanks for the help! Cheers!
I have an Excel 2007 Sheet with Macros. When I click on a button, it immediately pops up an error "File Not Found: VBA6.DLL"
Problem is, I have been using this sheet forever, and never seen this problem before. I did make some very very minor changes to the Macro code.
And, I have 2 other sheets with identical macro code which I made the same changes to. And those two sheets run fine.
Any ideas?
In this order:
Check your references (Alt+F11, Tools-References) to see if any are marked MISSING and make sure that Visual Basic for Applicatiions is checked.
Check the directory C:\WINDOWS\system32 for VBA6.dll
You may need to register VBA6.dll (Start->Run)
Regsvr32.EXE "C:\WINDOWS\system32\VBA6.dll"
I had the same problem with a shared file. The fix was as follows:
Un-share the file
Copy all macros; sheets, this workbook, modules and saved them in a text format.
Save the .xlsm as a .xlsx file
Save back to .xlxm file
Paste all macros back in
Reset shortcut keys and descriptions in macro options
Re-share the file
This worked without having to go to IT and get someone with administrative credentials to fix it.