Applescript and Excel problem

Anonymous
2017-04-26T09:21:32+00:00

I have a script that opens an Excel spreadsheet and loops through theCell. The character count for the first cell is 17 (theChrCount) and the contents of the cell (theCellValue) is "Application Files". When I run the script through the first loop, character 1 shows as "A". When I run through the second loop, character 2 shows "pl". The third shows character 3 as "lic" and so on. So the 6th character shows 6 values. Any idea why character 2 would show "pl" instead of "p"? It's like character n is the character at n for n places. This script ran well under the old version of Excel but stopped working on Microsoft Excel for Mac Version 15.33.

                                    set theCell to cell ("F" & i)

                                    set theCellValue to value of theCell as string

                                    set theChrCount to (get count of characters in theCellValue)

repeat with n from 1 to theChrCount --> 0.79s

set theChr to character n of theCell

set theChrProp to properties of theChr

set theFontObject to font object of theChrProp

end repeat

Microsoft 365 and Office | Excel | For home | MacOS

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

17 answers

Sort by: Most helpful
  1. Anonymous
    2017-04-26T13:07:05+00:00

    Hi Mike,

    Could you provide the following information?

    1. The Excel workbook you used.
    2. The script file. (.scpt file)
    3. Your Mac OS version.

    You can send the files to us via private message.

    Regards,

    James

    0 comments No comments
  2. Anonymous
    2017-04-26T14:30:54+00:00

    James, files were send via private message.

    0 comments No comments
  3. Anonymous
    2017-04-27T12:28:52+00:00

    Here is a screen shot of the values. Note that Character 1 is an "A" and bold/italic which is correct. Character 2 is "pp" and false for bold but the first p IS bold.

    0 comments No comments
  4. Anonymous
    2017-04-27T16:08:11+00:00

    Hi Mike,

    In Excel 2016 for Mac, the .scpt file must be in ~/Library/Application Scripts/[bundle id]/.

    The bundle IDs for Mac Word, Excel, and PowerPoint are:

    com.microsoft.Word

    com.microsoft.Excel

    com.microsoft.Powerpoint

    Would you please check this?

    If the issue remains, I would suggest you post this in MacScripter which is a specific support channel for Apple Script. Thanks for your understanding.

    Disclaimer: Microsoft provides no assurances and/or warranties, implied or otherwise, and is not responsible for the information you receive from the third-party linked sites or any support related to technology.

    Regards,

    James

    0 comments No comments
  5. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more