Hi, WolfPack, thanks for your reply, appreciate.
I have replaced the codes with the codes above. But I get 6 compile errors.
error C2065: 'openfile' : undeclared identifier
Looks like you have deleted the openfile declaration. See what happened to it. You should be able to correct errors like this.