The present invention provides a benzoic acid ester compound that has an enteropeptidase inhibitory effect, and use of the compound as a medicament for the treatment or prevention of obesity, diabetes mellitus, or the like.A compound represented by the formula (I) or a salt thereof has an enteropeptidase inhibitory effect and is useful as a medicament for the treatment or prevention of obesity, diabetes mellitus, or the like:[in the formula, each symbol is as defined in the specification] .