A surgical stapling apparatus comprises an endoscope, an elongate flexible tubular member slidably disposed in a biopsy channel of the endoscope, an elongate flexible rod member slidably disposed inside the tubular member and a staple disposed in a closed configuration inside the endoscope biopsy channel distally of the distal end of the rod member. The staple is releasably connected to the rod member. In operating the stapling apparatus, the endoscope is inserted through an aperture in a patient's body, the endoscope's optics being used to locate a surgical site. Upon finding the surgical site, a surgeon pushes the flexible rod in the distal direction to eject the staple from the endoscope biopsy channel. Upon ejection, the staple is opened, either through the action of its own internal forces or through the action of forceps jaws operated by the surgeon via an additional tubular member slidably disposed in the biopsy channel about the first tubular member. The rod is then pushed further in the distal direction to move the staple towards a blood vessel to be ligated or an opening to be closed. Upon sufficient engagement of the staple with the vessel or internal body tissues, the first tubular member is pushed in the distal direction to engage the staple legs and collapse them towards one another. The rod and the first tubular member are then retracted into the endoscope biopsy channel and the endoscope subsequently removed from the patient's body.