I assure the msgbox is the only error. I change the format to msgbox "some message" but still failed. And what I found is that When I use msgbox in other modules in the same workbook, they all failed and pump up same compile error. But when I change to other workbooks, the error message is gone...