On Error go to the next desired operation instead of next line

milkncookiez

New Member
Joined
Aug 16, 2013
Messages
2
How can I make this code

<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">For Each wb In wbC
If InStr(wb.BuiltinDocumentProperties("keywords").value(), "MyApplicationSet") = 0 Then
On Error Resume Next
End If
Call OverTimeSave(wb)
Next
</code>
so when the current workbook is not part of the system - it skips that one workbook (without saving it) and iterates to the next workbook? Is that code correct, because I am not sure the <code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">On Error Resume Next</code> will do the work here, as I read, it will just go to the next statement, which means it will call the save function on the particular workbook, which is not part of my system.

I want it like: if there's error - do nothing and iterate to the next workbook.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to MrExcel.

Like this?

Code:
    For Each wb In wbC
        If InStr(wb.BuiltinDocumentProperties("keywords").Value(), "MyApplicationSet") > 0 Then
            Call OverTimeSave(wb)
        End If
    Next wb
 
Upvote 0
Welcome to MrExcel.

Like this?

Code:
    For Each wb In wbC
        If InStr(wb.BuiltinDocumentProperties("keywords").Value(), "MyApplicationSet") > 0 Then
            Call OverTimeSave(wb)
        End If
    Next wb

Thank you! :)

I did it like that, as to work, but I wanted to find another solution where I can make use of the error handling somehow. Of course, if that is possible in my particular solution.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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