The file path separator on the Mac is the colon: not slash / Excel MVP Rob DeBruin has a web site that has examples of using file paths on a Mac. VBA code in Excel 2011 for the Mac. Tip: This guide and all examples are written in Excel 2016 for Windows, but the principles apply to Excel 2007 and newer for both Mac and PC. Why Use Excel Macros? Learning how to automate Excel is one of the easiest ways to speed up your workâespecially because Excel is used in so many work processes.
- Macro Excel 2011 Mac Tutorials
- Excel Macros Tutorial
- Excel 2011 For Mac
- Free Microsoft Excel Macro Tutorial
Macro Excel 2011 Mac Tutorials
willardpeabody
New Member
Hi!
I'm finding it difficult to do one specific thing. I want to open a workbook that has the same filename on 2+ different computers, all of these computers being Macs (OSX version 10.5 and later).
The problem is when I use the following code to open a specific workbook, it will only open on the computer with that Computer name ('Macintosh HD') and that user name ('MainUser'):
Workbooks.Open Filename:= _
'Macintosh HD:Users:MainUser:Documents:Folder1:Example.xlsm'
How do I get it to open a file with the same name and in the same folder, except on a different computer with a different user? (So that this file can be shared and my macros can run effectively on each computer.)
Is there some way to use a name for a computer/user that is generic and not specific to one computer and user? Can I open the workbook in another way without referencing the entirety of the file's path?
I own a copy of Mr. Excel's textbook 'VBA and Macros: Microsoft Excel 2010,' but I could not find an answer there!! Other solutions that I found online either involve Windows API, which the Mr. Excel textbook says only works on windows. Likewise, using some sort of Environ('username') function also does not work on a Mac, I'm told. I'm sure that there is someway this can work on a Mac!
I hope someone can help me with this simple problem! There's not a lot of support out there for Excel 2011 for Mac! (Especially because it's so new.)
Thanks so much,
Will
I'm finding it difficult to do one specific thing. I want to open a workbook that has the same filename on 2+ different computers, all of these computers being Macs (OSX version 10.5 and later).
The problem is when I use the following code to open a specific workbook, it will only open on the computer with that Computer name ('Macintosh HD') and that user name ('MainUser'):
Workbooks.Open Filename:= _
'Macintosh HD:Users:MainUser:Documents:Folder1:Example.xlsm'
How do I get it to open a file with the same name and in the same folder, except on a different computer with a different user? (So that this file can be shared and my macros can run effectively on each computer.)
Is there some way to use a name for a computer/user that is generic and not specific to one computer and user? Can I open the workbook in another way without referencing the entirety of the file's path?
I own a copy of Mr. Excel's textbook 'VBA and Macros: Microsoft Excel 2010,' but I could not find an answer there!! Other solutions that I found online either involve Windows API, which the Mr. Excel textbook says only works on windows. Likewise, using some sort of Environ('username') function also does not work on a Mac, I'm told. I'm sure that there is someway this can work on a Mac!
I hope someone can help me with this simple problem! There's not a lot of support out there for Excel 2011 for Mac! (Especially because it's so new.)
Thanks so much,
Will
Excel Macros Tutorial
This Excel tutorial explains the Project Explorer within the VBA environment in Excel 2011 for Mac (with screenshots and step-by-step instructions).
See solution in other versions of Excel:
![Excel Excel](https://i.pinimg.com/236x/72/95/8e/72958e9b501edf3b7a3fd8e4c05145fc--cheat-sheets-mac.jpg)
Project Explorer
The Visual Basic editor displays your VBA environment in Excel 2011:
Next, let's take a few moments to analyze the various sections in the Visual Basic editor.
Excel 2011 For Mac
In Excel 2011 for Mac, the Project Explorer is a window that can be accessed from the Visual Basic editor. It is a hierarchical listing of the objects recognized by VBA. Where to view screenshots on mac.
Free Microsoft Excel Macro Tutorial
In this example, there are four Excel objects which represent each sheet and workbook in your Excel file - Sheet1, Sheet2, Sheet3, and ThisWorkbook.
There is also one module called Module1. The VBA code in Module1 can used anywhere in your spreadsheet. Whereas, the code within an Excel object is typically only used by that object.
If the Project Explorer is not visible when you open the Visual Basic editor, you can make it visible by selecting Project Explorer under the View menu.