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.
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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
 

milkncookiez

New Member
Joined
Aug 16, 2013
Messages
2
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,737
Messages
5,597,826
Members
414,180
Latest member
Sir Khaya

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
Top