# Macros not working



## angel34

I migrated last week from a computer running Office 2007 on Windows 7 to a new computer running Office Professional 2010 plus on Windows 10. I am facing a weird problem since then. None of my macros seem to work on my new computer. My macros are all proven and have worked flawlessly for years.

I tried he following in order to solve the problem with no luck.

1. Enabled macros from Macro Security-->Macro Settings-->Disable all macros with notification so that they can be enabled when the workbook opens.

2. To rule out incompatibility issues, I have saved all workbooks containing macros in .xlsm format in Office 2010.

3. Macros created are all workbook specific hence stored in the respective workbooks and not in a Personal Macro Workbook). Hence, I guess, I could not find a .xlsb file in the XLStart folder (C/Users/Username/AppData/Roaming/Microsoft/Excel/XLStart). I thought of copying it in the XLStart folder of my new computer.

I do not know of any other measure that I could take at this moment so that the macros start working again.

I am at my wits end what to do about this problem further and is completely clueless about how to recover my macros since they are quite large in number and I do not have the time to recreate them. I shall be extremely thankful if somebody kindly guide me figure out the solution.


----------



## Joe4

angel34 said:


> 1. Enabled macros from Macro Security-->Macro Settings-->Disable all macros with notification so that they can be enabled when the workbook opens.


With this option, Macros are NOT automatically enabled.  When you open the file, they will still be disabled, but you should receive a notification that you can click to enable them.
Do you see this notification?
Are you acting on it and then enabling the Macro?

Another option is to make the folder containing the Macros a Trusted Location.
See here for details: Trusted Locations and Excel Macros - dummies


----------



## RoryA

What *exactly* do you mean when you say they don't work? Do they error? Will they not run? If they don't run, how are you trying to run them and what, if anything, happens when you try?


----------



## angel34

Thank you for choosing to reply to my query. When I click on the run button, nothing happens i.e. there are no changes in the work book. No error alert is thrown. The workbook remains as it were before running the macro.


----------



## angel34

Joe4 said:


> With this option, Macros are NOT automatically enabled.  When you open the file, they will still be disabled, but you should receive a notification that you can click to enable them.
> Do you see this notification?
> Are you acting on it and then enabling the Macro?
> 
> Another option is to make the folder containing the Macros a Trusted Location.
> See here for details: Trusted Locations and Excel Macros - dummies


Yes Sir. I disabled macros with notification in the Trust Centre as a security measure. I continue to receive a notification when I open the workbook and click to enable it.


----------



## Joe4

angel34 said:


> Thank you for choosing to reply to my query. When I click on the run button, nothing happens i.e. there are no changes in the work book. No error alert is thrown. The workbook remains as it were before running the macro.


Try placing a Message Box statement at the very beginning of your code, something like this:


		VBA Code:
__


MsgBox "Macro is running"


Then try clicking the button.  
If you see that Message Box pop-up, it tells you that the Macro is indeed being called and running successfully (it probably just isn't doing what you expect).
If you do not get that Message Box, then it tells us that the Macro is not being called (i.e. maybe the code is not actually mapped to the button, etc).


----------



## angel34

Joe4 said:


> Try placing a Message Box statement at the very beginning of your code, something like this:
> 
> 
> VBA Code:
> __
> 
> 
> MsgBox "Macro is running"
> 
> 
> Then try clicking the button.
> If you see that Message Box pop-up, it tells you that the Macro is indeed being called and running successfully (it probably just isn't doing what you expect).
> If you do not get that Message Box, then it tells us that the Macro is not being called (i.e. maybe the code is not actually mapped to the button, etc).


Yes. "Macro is running" message box pops up while the rest of the code doesn't work.  I guess there is a difference this time. This code has been typed in the vba window while the rest of the code has been copied from another computer, although I am not sure whether this makes any difference. I am running the code from Developer--->Macros-->Run button so the issue of not mapping the code to the button should not arise.


----------



## Joe4

I think we probably need to see the code then.
It may not be working quite the way you think or expect, possibly because it might not be referencing workbooks or worksheets correctly.


----------



## angel34

Joe4 said:


> I think we probably need to see the code then.
> It may not be working quite the way you think or expect, possibly because it might not be referencing workbooks or worksheets correctly.


The codes I use are proven and worked successfully for years in my old computer running Office 2007. I checked performance of the codes again on my old computer after this incident and found that they are still working as I desire them to be. Here, I am not talking of a single code, but there are altogether 63 Nos. of codes which have stopped working after the migration. You will kindly appreciate that 63 Nos. of codes cannot go wrong at the same time. So, I feel the coding (referencing workbooks/worksheets) or anything for that matter which relates to the structure of the code cannot be blamed here. There may be a problem in the set up/ configuration of my new computer which is impeding the functioning of the macros and which I am not able to figure out.


----------



## Joe4

Well, without seeing your code and/or having access to your system, I am afraid that there probably isn't much more assistance I can offer.

I would recommend adding a break-point to the Message Box we just added, and try running the code again.  Then, it should stop at this line of code.
You can then proceed through your code line-by-line using the F8 key to see exactly what is going on.  
If you do this while watching what happens on your sheets, many times the problem will reveal itself.


----------



## angel34

I migrated last week from a computer running Office 2007 on Windows 7 to a new computer running Office Professional 2010 plus on Windows 10. I am facing a weird problem since then. None of my macros seem to work on my new computer. My macros are all proven and have worked flawlessly for years.

I tried he following in order to solve the problem with no luck.

1. Enabled macros from Macro Security-->Macro Settings-->Disable all macros with notification so that they can be enabled when the workbook opens.

2. To rule out incompatibility issues, I have saved all workbooks containing macros in .xlsm format in Office 2010.

3. Macros created are all workbook specific hence stored in the respective workbooks and not in a Personal Macro Workbook). Hence, I guess, I could not find a .xlsb file in the XLStart folder (C/Users/Username/AppData/Roaming/Microsoft/Excel/XLStart). I thought of copying it in the XLStart folder of my new computer.

I do not know of any other measure that I could take at this moment so that the macros start working again.

I am at my wits end what to do about this problem further and is completely clueless about how to recover my macros since they are quite large in number and I do not have the time to recreate them. I shall be extremely thankful if somebody kindly guide me figure out the solution.


----------



## angel34

Joe4 said:


> Well, without seeing your code and/or having access to your system, I am afraid that there probably isn't much more assistance I can offer.
> 
> I would recommend adding a break-point to the Message Box we just added, and try running the code again.  Then, it should stop at this line of code.
> You can then proceed through your code line-by-line using the F8 key to see exactly what is going on.
> If you do this while watching what happens on your sheets, many times the problem will reveal itself.


Yes Sir. I appreciate. I will do what you advised and revert back. Thank you for your help and the valuable time you spent in replying to my query.


----------



## Joe4

You are welcome.
Good luck!


----------



## angel34

I tried to debug my code by stepping into it in vba editor. But the process doesn't advance beyond line 1, Macro is running. Do you think uninstalling and reinstalling Office might be a solution? But again I noticed that the code I type on the vba editor, works perfectly. The problem is just with the code I copied from the other computer.


----------



## Joe4

angel34 said:


> I tried to debug my code by stepping into it in vba editor. But the process doesn't advance beyond line 1, Macro is running.


When you add a break point, it will stop at that point.  You then manually advance through the code one line at a time by pressing the F8 key repeatedly.
Are you saying that when you press the F8, it does not move off of the line with the breakpoint?


----------



## angel34

Yes Sir. That is precisely what is happening. When I press F8 at the breakpoint, nothing happens. The debugger doesn't move to the next line of the code. Is it possible that the files got corrupted either while transferring or while storing it in a external hard drive before being copied?


----------



## Joe4

Corruption sounds like a good possibility.


----------



## LPerilla

angel34 said:


> Yes Sir. That is precisely what is happening. When I press F8 at the breakpoint, nothing happens. The debugger doesn't move to the next line of the code. Is it possible that the files got corrupted either while transferring or while storing it in a external hard drive before being copied?


Have you found a solution for this? I have a similar problem with my files with multiple macros and are currently not working with no error message since my migration to another PC. If such file is indead corrupted, as @Joe4 has mentioned, then the file should not work in other PCs, right? But when I tried it in my colleagues' PCs, it works just fine.


----------



## Joe4

LPerilla said:


> Have you found a solution for this? I have a similar problem with my files with multiple macros and are currently not working with no error message since my migration to another PC. If such file is indead corrupted, as @Joe4 has mentioned, then the file should not work in other PCs, right? But when I tried it in my colleagues' PCs, it works just fine.


If they work on other computers, I would doubt your file is corrupted.  It is most likely same settings on that one computer.
Are you sure that you have enabled Macros/VBA on that one computer that they are not working on?


----------



## LPerilla

Joe4 said:


> If they work on other computers, I would doubt your file is corrupted.  It is most likely same settings on that one computer.
> Are you sure that you have enabled Macros/VBA on that one computer that they are not working on?


Yes, Macros Settings is set to "Disable with notifications", and everytime I open an Excel file with macros, I enable said macros. To add, macros that I create on my PC are working on my PC and others, while macros created from other PCs does not work on my PC.


----------



## MARK858

Are you sure that the files aren't blocked by Windows? if you are transferring them from the other other computers via email, shared server or via the net then they probably are.

Easiest way to check is to right click the file - click properties - click the General tab and look near the bottom and see if you have an Unblock box as below in the image. If you do then check the box and click OK.


----------



## angel34

I migrated last week from a computer running Office 2007 on Windows 7 to a new computer running Office Professional 2010 plus on Windows 10. I am facing a weird problem since then. None of my macros seem to work on my new computer. My macros are all proven and have worked flawlessly for years.

I tried he following in order to solve the problem with no luck.

1. Enabled macros from Macro Security-->Macro Settings-->Disable all macros with notification so that they can be enabled when the workbook opens.

2. To rule out incompatibility issues, I have saved all workbooks containing macros in .xlsm format in Office 2010.

3. Macros created are all workbook specific hence stored in the respective workbooks and not in a Personal Macro Workbook). Hence, I guess, I could not find a .xlsb file in the XLStart folder (C/Users/Username/AppData/Roaming/Microsoft/Excel/XLStart). I thought of copying it in the XLStart folder of my new computer.

I do not know of any other measure that I could take at this moment so that the macros start working again.

I am at my wits end what to do about this problem further and is completely clueless about how to recover my macros since they are quite large in number and I do not have the time to recreate them. I shall be extremely thankful if somebody kindly guide me figure out the solution.


----------



## LPerilla

MARK858 said:


> Are you sure that the files aren't blocked by Windows? if you are transferring them from the other other computers via email, shared server or via the net then they probably are.
> 
> Easiest way to check is to right click the file - click properties - click the General tab and look near the bottom and see if you have an Unblock box as below in the image. If you do then check the box and click OK.
> 
> View attachment 82490


Upon checking, the files are not blocked by Windows. I think it is also worth mentioning that the laptop I am currently using was recently reformatted. I don't know if this have an effect on the Excel app, especially the macros, but ever since this laptop was reformatted, the macros were not working anymore. On some files, I also encounter the error message "Microsoft Visual Basic for Applications: File Not Found".

Note that all the Excel files I'm trying to open works fine before the reformatting.


----------



## Joe4

LPerilla said:


> Upon checking, the files are not blocked by Windows. I think it is also worth mentioning that the laptop I am currently using was recently reformatted. I don't know if this have an effect on the Excel app, especially the macros, but ever since this laptop was reformatted, the macros were not working anymore. On some files, I also encounter the error message "Microsoft Visual Basic for Applications: File Not Found".
> 
> Note that all the Excel files I'm trying to open works fine before the reformatting.


That DEFINITELY indicates an issue with that particular computer.
In sounds like you may have an incomplete installation.
I would recommend reinstalling Office, and be sure to apply all updates and patches.


----------

