This means you do a second thing when you are already doing a first thing. You use the chance to do something extra. It is like saying 'while you are at it'.
に、ATMで。
While I'm going to the convenience store, I'll withdraw some money from the ATM.
に、。
When I went to Osaka on a business trip, I took the opportunity to visit an old friend.
、。
An apology is not something that you should do 'while you're at it' with something else.
、に?
Since you're going for a walk, could you mail this letter for me?
へに、。
When I went to the library to return a book, I took the opportunity to borrow a new one.