Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the cause of the "path/file access error" error

Tags:

excel

vba

The hard part of this error is that it does not occur all the time, but I think it is due to the userforms. The program works as it should most of the time, but eventually Error 1 pops out. After Error 1 pops out, when I attempt to double click any other userform module in the VBE, Error 2 would pop out. I believe Error 1 occurs because the program is unable to access the user forms as shown by Error 2. When we attempt to save the Excel file after the error occurs, the excel file would crash. I also noticed that the errors start after a certain amount of time (even when idling and alt+tabbed) after not doing anything for example, 20 minutes, then try to select a userform, it will error (note: I do not have any time activated code for sure). Similar problems were noted in these URLs but no solutions: Similar problem and Similar problem 2. After checking google, this problem have been plaguing people for more than 10 years already. Has no one ever figured out the cause for theirs? Any help would really be much appreciated for other people as well. Update: Errors occur in Excel 2007 (both computers at the office). I've never seen the error occur to my yet at home with my Excel 2016.

The images of the errors and debugging are shown below:

Error 1:

Error 1

Error 2:

Error 2

After Error 1 occurs and try to save the file crash: Crash

Debug (all userforms will stop working):

Debug in VBE 2

like image 602
Pherdindy Avatar asked Jun 13 '18 07:06

Pherdindy


2 Answers

Both errors you are having, "Path/File access error" and "Run Time Error 75" are errors accessing the filepath, and they are likely being caused by the AutoRecover feature of Excel.

When you are leaving your Excel file for 20 minutes or so, the time limit for AutoRecover is reached. AutoRecover will then attempt to save AutoRecover information, in the case of your home computer it will be saving that to the Local drive, and at the office it will be saving to the network.

When an Excel file is open and AutoRecover is turned on, AutoRecover does not save the file until the first change is made to the file, the AutoRecover save time interval passes, and Excel has been idle for some time (the default is 30 seconds). (https://support.microsoft.com/en-us/help/289273/description-of-the-autorecover-functions-in-excel)

What is likely happening is a connection with your network is being interrupted, causing the AutoRecover to fail, which you won't see until the 'ActivateWorkbook' event is triggered (which will show your userform, then crash).

(You can check your time limit for AutoRecover in Options>Save>Save Workbooks) Save Options Image

You might be able to work around the error by:

  • saving the file to your local drive while you are at the office, or
  • disabling AutoRecover for the workbook
  • increasing the amount of time before the AutoRecover is triggered.

This user also found their errors were resolved by removing and repairing corrupt updates: https://www.mrexcel.com/forum/excel-questions/438888-intermittent-run-time-error-75-loading-form.html

Hope this helps!

like image 84
girlvsdata Avatar answered Oct 12 '22 15:10

girlvsdata


you can just save the current workbook with this:

ActiveWorkbook.Save

or disabling auto recover with code

Application.Autorecover.Enable = False
like image 40
Rozety Avatar answered Oct 12 '22 16:10

Rozety