Share via

Visual Basic incompatibility with the CHR function between MAC Excel and Windows Excel.

Anonymous
2013-07-03T19:42:47+00:00

I am writing a Visual Basic Excel Application that needs to run in both Windows 7 and Mac OS 10.

The program runs fine on Windows. I am stymied by one error. The CHR function is not recognized in the Mac.

I have tried CHR, CHAR with no avail. I tried it in two different Macs.

Please advise what I can do.

  • indra
Microsoft 365 and Office | Excel | For home | Windows

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

Answer accepted by question author

Anonymous
2013-07-07T06:30:30+00:00

CHR definitely works in VBA in Mac.

CHAR also should work in a worksheet.

Both are 100% cross-platform compatible.

Try this simple function:

Sub test()

MsgBox Chr(97)

End Sub

Let us know if this macro fails.

Regards,

Edwin Tam

Excel Power Expander - http://www.vonixx.com

Was this answer helpful?

0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-07-06T13:20:57+00:00

    Please see additional information added to my original post

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-07-06T13:20:12+00:00

    I am writing a Visual Basic Excel Application that needs to run in both Windows 7 and Mac OS 10.

     

    The program runs fine on Windows. I am stymied by one error. The CHR function is not recognized in the Mac.

     

    I have tried CHR, CHAR with no avail. I tried it in two different Macs.

     

    Please advise what I can do.

     

    • indra

     

    Additional information

     

     

     

    1. The original VB Excel Macro was developed under Windows 7 and Excel 2010
    2. Trying to run the same Macro in a Mac running OS 10.8 is where I saw the issue
    3. The Mac version of Excel is Excel 2011 Version 14.3.5

     

     

     

    'The CHAR function works in Excel in regular excel program in the MAC. But from Visual Basic

    CHR, CHAR, WorksheetFunction.CHAR, WorksheetFunctionCHR,- none of these worked.

     

     

     Since I had only a couple of references to this function, I wrote the ASCII table in a different worksheet and did a search to keep me going, effectively doing the same function. I have seen a similar problem with LOWER function as well. It seems I have problem with a few Excel built in functions when running from VB Excel.

     

    Any help will be welcome, because this is a huge productivity impact.

     

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-07-05T12:23:05+00:00

    CHR is a VB function that works fine on mac Excel. CHAR is a worksheet functiion that does the same thing, and also works fine on the Mac. In VB, CHR or application.char should give identical results.

    Can you please explain in more detail (with specific examples) what you are seeing and what is happening.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-07-04T14:21:18+00:00

    CHAR should work according to this:

    http://office.microsoft.com/en-in/mac-excel-help/char-function-HA102927526.aspx

    Can you provide the exact error message you get?

    Was this answer helpful?

    0 comments No comments