VBA syntax to repair corrupted file

Status
Not open for further replies.

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
1,476
I need some help with some vba syntax. I have part of a procedure that opens another workbook, performs some actions then closes it. This is the code I have:

Code:
Workbooks.Open (ThisWorkbook.Path & "\" & DocYearName)
All the workbooks are stored in the same folder and the variable DocYearName contains the file name of the workbook to be opened. I have had a heap of trouble with workbooks being corrupted and I have no idea why they are being corrupted.

How do I incorporate repairing a corrupted file into this command?
 
Last edited:

Some videos you may like

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Macropod

Retired Moderator
Joined
Aug 27, 2007
Messages
3,445
I have had a heap of trouble with workbooks being corrupted and I have no idea why they are being corrupted.
Instead of trying to work around the issue, you should sort it out at the source.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,972
Office Version
2013
Platform
Windows
@Macropod
Already suggested stepping through with F8 to see if it works manually first.....then maybe look at a wait line, if it does !!!
 
Status
Not open for further replies.

Watch MrExcel Video

Forum statistics

Threads
1,102,552
Messages
5,487,524
Members
407,604
Latest member
sama9000

This Week's Hot Topics

Top