Thanks for your help.
Actually the problem was that the macro was triggered by an open file event.
If I run it manually it works.
Is this the way it is suppose to work. That if it triggered by an open file event it can not open a file in the current tab which would then close the original file?