A generalization of Vesentini and Wermer's theorems