![]() |
Capture Update Links Error?
Hello. I have some code that mainly references a worksheets 2 columns -
column D has the full path of a file, column A has a checkbox. The code opens every file (one at a tine) that is listed in column D with a check in A, updates links, prints the sheets listed in columns E through BB, and then finally closes the file. It then loops through all files listed. My issue is this - if I come across a file that has bad links, I get the popup message indicating so. When I choose do not update links, the code errors out. What I would like to happen is that the file is still opened, links do not get updated if there are bad links, the file is left open and the loop continues. So in the end, the only files that are still open will be by default files with bad links. Is this possible? Thanks!! My code is below: Sub PrintFiles() Set rng = Range("D7:D" & Range("D65536").End(xlUp).Row) For Each cell In rng If Trim(cell.Value) < "" Then If Cells(cell.Row, 1).Value = True Then WbOpen = cell.Value Workbooks.Open (WbOpen), UpdateLinks:=1 Set bk = ActiveWorkbook ThisWorkbook.Activate Set rng1 = cell.Offset(0, 1).Resize(1, 50).SpecialCells(xlConstants) For Each cell1 In rng1 If LCase(cell1.Value) = "all" Then bk.PrintOut Exit For Else If Trim(cell1.Value) < "" Then bk.Worksheets(cell1.Value).PrintOut End If End If Next WbOpen = "" bk.Close SaveChanges:=True Set bk = Nothing End If End If Next End Sub |
All times are GMT +1. The time now is 10:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com