ADD PERPENDICULARS

Hello,
I have 1 segment A and 1 line B
How to make perpendiculars from segment A end points to line B - red lines. I need VBA code.
Why I need. Because so i find the closest endpoint A to line B. Then segment A will be extended from closest endpoint to intersect with line B
Any idea how to find the intersection coordinates X, Y of the continuation of segment A with line B would be gratefully received.
Greetings!