Reliance and police officers managed to remove the weapon from a clearly distraught Gemma Moffat, as she attempted to cut herself while being taken from the dock.
There were gasps from the public benches, and the court was briefly adjourned, as efforts were made to deal with the 26-year-old first offender.
Moffat of Windram Road, Chirnside, appeared on indictment and admitted embezzling 40,000 while an employee of the Royal Bank of Scotland in Chirnside and Duns, between April 14, 2008 and October 13, 2008.
She also admitted possession of the embezzled money in bank accounts held by herself, her husband, and her daughter, between the same dates.
The court heard how Moffat used the money to clear debts, fund a holiday, and buy a laptop and other goods.
None of the 40,000 she took was recovered.
Moffat obtained seven signed blank cheques from a 78-year-old widow in the early stages of dementia, and used her position in the bank to ensure there were enough funds in the woman's current account to meet the withdrawals by transferring money from her savings account.
A blackening depression following the difficult and life-threatening birth of her first child was said to have taken Moffat into a psychiatrically driven fantasy life, according to her defence advocate.
Depute fiscal Tessa Bradley said the victim was a 78-year-old neighbour, recently widowed, and living with her son who has severe learning difficulties.
Miss Bradley said the woman's late husband dealt with their finances and since his death, and suffering the early stages of dementia in 2008, she had "struggled to cope."
The woman was a customer of the Royal Bank of Scotland's Chirnside branch, where Moffat worked for seven years.
Miss Bradley said Moffat visited the woman at her home in April 2008 and suggested she set up a direct debit, adding that she would require two signed cheques.
The woman signed the two cheques and Moffat told her she would fill in the necessary amount.
When the woman told a neighbouring couple what had happened, they suggested it was "peculiar" and advised her to get the cheques back, but the woman said she trusted Moffat as she worked for the bank.
The accused obtained a further five blank cheques - a total of seven - between April and October 2008.
These cheques were debited from the elderly woman's current account, and totalled 40,000.
"The accused dated the cheques and made them payable to herself, her husband and her daughter, with amounts varying between 3,000 and 16,000," explained Miss Bradley.
"Funds were transferred from the lady's savings account by the accused, into her current account to ensure there were enough funds to secure the cheques."
In April 2009, the woman's nephew noted large withdrawals when looking through her bank statements, and transfers from her savings to her current account.
He reported matters to the bank, who began enquiries.
Moffat was interviewed by a fraud investigator from the bank and claimed the money was a gift from her neighbour.
When matters were reported to police, Moffat confirmed she had access to the bank system and admitted deceiving the woman by obtaining signed cheques, adding amounts, and making them payable to herself, her husband and her daughter.
"She said only she knew about the crime and her husband thought it was a child bond which had matured," continued Miss Bradley.
"She said the 40,000 had been spent on clearing various debts, a holiday, laptop, camera, etc," said Miss Bradley. "There has been no recovery as all the funds have been spent."
Moffat's advocate Gerry Coll said the victim had been compensated by the bank.
"The remark that this was a gift is part of the psychiatric driver behind this serious offence," he explained.
He said Moffat had expressed "heartfelt sorrow" and was "entirely ashamed" of her crime, which had deep consequences for others.
Mr Coll said there had been "a bond of trust for some years before this" between the woman and the accused, and the offence had brought shame on his client's family.
"It is a course of conduct which could be characterised as planned and calculated," continued the advocate, "but there is a psychiatric root to it."
He said there had been some fear for Moffat's life during the birth of her first child, which had left her "traumatised".
"Her blackening depression went unrecognised and undiagnosed and she simply didn't tell anyone," he continued.
Mr Coll said a "psychiatrically driven fantasy life" had enabled Moffat to persuade herself that "had she asked for the money, it would have been given to her.
"In an odd sense, she almost provided for her family in the event of her dying in her second pregnancy," he continued.
The advocate said Moffat had "accepted culpability and was completely frank and open" to police.
"Had she been able to speak about the darkness in her life, this may well have been diverted," he concluded.
Sheriff Kevin Drummond said Moffat had committed a substantial breach of trust with substantial financial gain by taking advantage of an elderly and trusting neighbour.
"In the course of your employment you embezzled 40,000 which you expended wholly for your own purposes.
"Your deception involved taking advantage of an elderly and trusting neighbour in the early stages of dementia on seven separate visits," he added.