Corrupt VBA file on save

Nour

New Member
Joined
Jun 16, 2021
Messages
34
Office Version
  1. 2016
Platform
  1. Windows
I have this macro application for POS and clinic register. However I just made some addition to the macro to increase the functionality but once it opens the first time, it refuses to open the second time and says repairing file and exit excel. My macros have no errors. In fact even the macros are not even called but the user form refuses to initialize. I need help. I have even attempted increasing the modules to 5 from 3 and but nothing works.
 
You can post the workbook to a download site (DropBox.com, etc) then provide the link here.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I tried to load your workbook and receive an error message re: missing the following library :

Library.jpg







Additionally, when first loading your workbook it is asking me for a password to the VBE. I tried the letter "a" but that didn't work.
The initial error message displayed when first opening the workbook basically says .... "There is an error on Sheet X. Do you want to continue ?" The
letter X refers to a tab number. Here, the errors go through all the sheets of the workbook.

At this point my only recommendation is to start fresh. Create a new workbook ... then manually re-enter everything into this new workbook - both the macros and
the sheet layouts. Do not copy and paste because you will inevitably copy something that is corrupted and paste it into the new workbook.

Sorry for this realization.

After creating the new workbook and verifying it works as desired ... create a clean copy and store it somewhere safe for possible future use. Regretfully I've had to
do this same thing on a few of my projects.
 
Last edited:
Upvote 0
I tried to load your workbook and receive an error message re: missing the following library :

View attachment 99935






Additionally, when first loading your workbook it is asking me for a password to the VBE. I tried the letter "a" but that didn't work.
The initial error message displayed when first opening the workbook basically says .... "There is an error on Sheet X. Do you want to continue ?" The
letter X refers to a tab number. Here, the errors go through all the sheets of the workbook.

At this point my only recommendation is to start fresh. Create a new workbook ... then manually re-enter everything into this new workbook - both the macros and
the sheet layouts. Do not copy and paste because you will inevitably copy something that is corrupted and paste it into the new workbook.

Sorry for this realization.

After creating the new workbook and verifying it works as desired ... create a clean copy and store it somewhere safe for possible future use. Regretfully I've had to
do this same thing on a few of my projects.
I am sorry for the password issue. I realised like I sent one of the ones I was trouble shooting. I have never gotten any error. I will upload a cleaner version. The missing library, you have to install by doing to tools, references and Microsoft Windows common controls 6.x(sp6). It will be there if you have installed mscomctl.ocx to your office. I have recorded a video to show you the exact problem. Will send the link shortly. Thank you very much for the concern.
 
Upvote 0
merged video_1.mp4 for video description of problem
Patient register UCold.xlsb an earlier copy before my changes
Patient register UC.xlsb file with the problem
MSCOMCT2.zip library reference add-in
Also if you are not using 32bit version of office, please delete an reference to modal and modeless in the vba or else it will describe it as error as 64bit does not recognise the function............
Private Declare Function EnableWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal fEnable As Long) As Long, EnableWindow Application.hWnd, Modeless and Const Modal = 0, Modeless = 1
 
Last edited:
Upvote 0
I guess I'll have to take a step back and let someone else review your files.

The MCCOMCT2.OCX will not load on my machine because I am running Win 10 / 64 bit. That OCX is designed for 32 bit only.

I tried opening the PATIENT REGISTER UC.XLSB workbook but it defaults to an error as well saying it cannot find the OCX file.

I tried to get into the VBE to look at your code but the VBE is password protected. The letter "a" does not act as a password there.
 
Upvote 0

Forum statistics

Threads
1,215,393
Messages
6,124,680
Members
449,180
Latest member
kfhw720

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