I tried something similar in my recent spanish campaign,

The milanese were getting too big, and the HRE was beign destroyed by a combined assault from the danish, venetians and of course the milanese, so I decided to do something about it and assaulted Genoa thus removing the annoying milanese fleet (I had taken marseille and ajaccio already) and began moving into germany

Anyway after some turns I see a milanese diplomat aproach the pope, don't know what kind of deal was negotiated in the dark corners of the vatican, but the next turn the pope tells me to stop attacking, unfortunately I can't comply since my army survival depended on taking a castle from the milanese for rest and retraining so, confident in our perfect realtions with the pope I decide to take the castle

The pope then decided to excommunicate me and DECLARE WAR on me, even though my king had the "respected by the pope" trait (I had retaken rome in a crusade from the venetians and retuned it to the papal states)

In any case I managed to destroy the milanese withouth engaging its huge army by a moving from castle to castle and then offering the new lands to the HRE (which by this point had allied with the milanese ), the assasins did the rest and adios milan

I't was quite fun, though the situation with the pope is still unresolved even 30 years later