excel - How to use InStr function in VBA 2003? -
the code below returned error 5 @ instr call:
option explicit sub test() dim wb workbook dim wbs workbooks dim str string dim lposition integer set wbs = application.workbooks each wb in wbs str = wb.name lposition = instr(0, str, "_", vbtextcompare) msgbox lposition next wb end sub
could please explain why?
start index of instr
function 1-based => 0 invalid value.
see exceptions section of http://msdn.microsoft.com/en-us/library/8460tsh1%28v=vs.80%29.aspx
Comments
Post a Comment