locked
Windows Excel 2010 VBA Compatibility with Mac Excel 2011 VBA RRS feed

  • Question

  • I am developing a few macros on Windows Excel 2010 VBA and I want to make sure these macros will work on a Mac too but I am having difficulty finding the Object model for the Mac Excel 2011 VBA. I know there are some methods/properties that do not appear to be working on the Mac so I was wondering if there is an object model available that I can look-up various objects to make sure they exist for the Mac. Specifically, I am interest in the following properties:

    Application.UserName
    Application.OrganizationName
    Application.ProductCode
    Application.OperatingSystem
    Application.StartupPath
    Application.TemplatesPath
    Application.UserLibraryPath
    Application.Version

    I have also been told that GetSetting and SaveSetting works on the Mac but I have not been able to confirm this.

    Thanks



    • Edited by PTMark Thursday, September 5, 2013 9:15 PM
    Thursday, September 5, 2013 8:26 PM

Answers

  • Application.UserName returns the name of the user which is set independently in Office. And I believe that it works for MAC as well. I guess you want the logged in user which is similar to Environ("username")

    If this is what you are looking for then you will have to use Applescript for that and for the rest. For example

    Function GetUserNameInMac() As String
        Dim scrpt As String
    
        scrpt = "set userName to short user name of (system info)" & _
                vbNewLine & _
                "return userName"
    
        GetUserNameInMac = MacScript(scrpt)
    End Function


    Sid

    Friday, September 6, 2013 3:52 AM