+ Reply to Thread
Results 1 to 5 of 5

Excel VBA scripts on Office for MAC 2011

  1. #1
    Registered User
    Join Date
    05-05-2010
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    20

    Excel VBA scripts on Office for MAC 2011

    This may be a long shot but...I have a couple spreadsheet macros and thanks to the help of the fine folks on this forum they all work fine in Excel 2007 and 2010. My user received a MAC for christmas with Office for MAC 2011. None of my scripts work on his MAC. I did some research and VBA is supposed to be supported in that version.

    So for starters, does anyone know some code I can add to the front end of the scripts that will determine whether it is running on a MAC or a PC so I can differentiate different segments of code for each? I would like it to work on both.

    Secondly I suspect that at least two of my scripts do not work because of something to do with file/folder structure differences. Here is one of those scripts:

    Please Login or Register  to view this content.
    So all this does is allow you to select another spreadsheet and it copies some of the data from that spreadsheet to the current one.

    Here is an additional problem for me, currently I have no access to a MAC with Office for MAC 2011 to use for testing to figure out how to fix this. Which also unfortunately means I do not know off hand where it is failing. I am working on getting something I can use for testing and development on this but since I am not really willing to put out money to buy my own copies of OS X and Office for MAC 2011 to resolve this issue that may not happen.

    If by some miracle someone who does have said operating system and Office version looks at this and knows what's wrong, I would surely appreciate a version of this code that runs on MAC. I believe I could then modify at least one of the other scripts and get it working as well.

    All help or suggestions appreciated.
    Last edited by MnMShow; 01-21-2011 at 04:29 PM.

  2. #2
    Registered User
    Join Date
    05-05-2010
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Excel VBA scripts on Office for MAC 2011

    Well for those who are interested, part of my solution involves differentiating the Mac OS from windows. I did that with this bit of code:

    Please Login or Register  to view this content.
    This bit of code will either return "Win" or "Mac" and you can then program accordingly.

    So the next obstacle I had was using FileFilter with Application.GetOpenFilename. The way to do this on the Mac is:

    Please Login or Register  to view this content.
    I also had to flat out drop some of the code to look for the file to open at a specific file path. I have a couple more hurtles to resolve but with these changes the code at least works now.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Excel VBA scripts on Office for MAC 2011

    Have you looked at conditional compilation
    Please Login or Register  to view this content.
    You could do something like

    Please Login or Register  to view this content.
    Last edited by mikerickson; 01-15-2011 at 03:43 AM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    05-05-2010
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Excel VBA scripts on Office for MAC 2011

    Hey I like that. This particular script is not too long or complicated but I have longer and more complicated one I need to work through next so that technique should make it much cleaner. Thanks for the suggestion.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Excel VBA scripts on Office for MAC 2011

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1