Microsoft Word’s applescript command to convert a text range to a table using separators fails.
set theList to {1, 2, 3, 4, 5, 6}
my ConvertToTableFrom:theList
on CreateParagraphDelimitedStringFromList:theList
set AppleScript's text item delimiters to return
set theString to theList as string
set AppleScript's text item delimiters to ""
theString
end CreateParagraphDelimitedStringFromList:
on ConvertToTableFrom:theList
tell application "Microsoft Word"
set content of text object of active document to my CreateParagraphDelimitedStringFromList:theList
-->The following succeeds but creates a table with only one column
convert to table (text object of active document) number of columns 3
-->The following fails altogether, generating a Microsoft Word error that the text object of active document doesn’t understand the “convert to table” message.
convert to table (text object of active document) separator separate by paragraphs number of columns 3
end tell
end ConvertToTableFrom:
Microsoft Word lists an option to this command as WdTableFieldSeparator (enumeration) with one of its constants including ‘separate by paragraphs’.
As I cannot find the reason for applescript failing with the separator option, I would be thankful for any insight.