This code is for VBA within Excel, not for Visual Basic 6.5. In your question you asked for VBA and not VB, there is a difference.
Please close this question by accepting this comment 33039684 as it answers the original question posted and re-open a new question specifying a VB 6.5 solution and not a VBA solution.