Syntax
excelpaste
Copyright 2023-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This algorithm is designed to facilitate the insertion of multi-paragraph text into Excel on macOS. It is particularly useful when dealing with text that requires quotation marks for proper formatting in Excel.
Input Parameters
The function does not take any input parameters directly from the user. It operates on the content currently stored in the clipboard.
Algorithm Steps
- Retrieve the current content of the clipboard using the command
txt=clipboard('paste')
.
- Check if the text in the clipboard starts with a quotation mark using
if ~startsWith(txt,'"')
.
- If the text does not start with a quotation mark, proceed to the next steps:
- Replace any existing quotation marks in the text with double quotation marks. This is done using the function
strrepn(txt,'"','""',newline,[char(13) char(10)])
. This ensures that any internal quotation marks are properly escaped for Excel.
- Enclose the entire text in quotation marks by concatenating
'"'
at the beginning and end of the text. This is achieved with nxt=['"' nxt '"']
.
- Copy the modified text back to the clipboard using
clipboard('copy',nxt)
.
- If the text already starts with a quotation mark, no changes are made, and the function ends.
Output
The function does not return any output to the user. Instead, it modifies the clipboard content, which can then be pasted into Excel using the standard paste command (CMD-V).
Additional Information
This function is part of the SolidGeometry library and was introduced in version 5.3. It is designed to work on macOS systems where Excel requires text to be properly formatted with quotation marks for multi-line entries.
Algorithm explaination created using ChatGPT on 2025-08-19 00:13. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21