VBA Macros being deleted when saved

peakoverload

New Member
Joined
Aug 19, 2014
Messages
10
I'm a real newbie when it comes to VBA and macros so apologies in advance if I'm using the wrong terminology in some of this.

I've created a workbook called a Job Sheet Generator. We use this to enter information about a particular job which when we click on a button, saves the workbook as a new one, which we call a tracking sheet and also updates a couple of other external workbooks.

Both the Job Sheet Generator and the Tracking Sheets it creates have several macros in them written in a VBA module. The macros do various things from resetting all cells, to performing more advanced time calculations and then further updating other external workbooks.

Both the Job Sheet Generator and the resulting Tracking Sheets are saved in xlsm format and all PC's on which these are used are set to always enable macros.

We are finding though that at random the macros are getting deleted at some point when the tracking sheet is updated and saved. No notification is shown on screen saying that this is happening and the first we know about it is when the next person open the tracking sheet and tries to click on one of the buttons only to be told that the macros are missing. When I look in VBA I see that the module object has been deleted.

Yesterday this happened on one file and I was able to look at all the versions of it that had been created each time the tracking sheet had been worked on.

The first version, the version first created by the job sheet generator was fine, all macros present
The next 7 versions as staff members kept updating the sheet with their progress on the particular job was fine too, all macros present
The 8th version though, although still in xlsm format, now didn't have any macros and the module object was deleted

I know that if the workbook is saved in xlsx format that will delete the macros but it's still in xlsm format so I can't workout how the module object is being deleted.

This has happened now on 5 separate workbooks in the past fortnight.

Does anyone know what could be causing this?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Could this be some "Group Policy" relating only to the 8th person's computer preventing them from saving the macros?

What happens if you create a new workbook with a sample macro and save that through the 8 PC's?
Does the 8th PC delete that macro too?
If it deletes the macro it would point to some policy regarding macros not being saved.
If it retains the macro then it would point to some problem with the your workbook.

Could this be add-in related?
 
Upvote 0
Could this be some "Group Policy" relating only to the 8th person's computer preventing them from saving the macros?

What happens if you create a new workbook with a sample macro and save that through the 8 PC's?
Does the 8th PC delete that macro too?
If it deletes the macro it would point to some policy regarding macros not being saved.
If it retains the macro then it would point to some problem with the your workbook.

Could this be add-in related?

Aha, solved it. Managed to track down what PC had been used on that 8th time and it turns out that VBA hadn't been installed. Installed now and all working again.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top