
- Define sub in excel vba on mac update#
- Define sub in excel vba on mac mac#
- Define sub in excel vba on mac windows#
Set KeyValuePair = KeyValuePairs.Item(1 + Index) ' collections are 1-based Public Property Get KeyValuePair(Index As Long) As Variant ' returns KeyValuePair object Vlist(i) = KeyValuePairs.Item(1 + i).Key ' ReDim vlist(0 To Me.Count - 1) ' to get a 0-based array same as scripting.dictionaryĪssignVariable vlist(i), KeyValuePairs.Item(1 + i).value ' could be scalar or array or object Public Property Get Items() As Variant ' for compatibility with Scripting.Dictionary 'show error if not there rather than On Error Resume Next Public Property Get Exists(Key As String) As BooleanĮxists = TypeName(KeyValuePairs.Item(Key)) > "" ' we can have blank key, empty item Public Sub Add(Key As String, Item As Variant) ' Collection parameter order is Add(Item,Key) Dictionary is Add(Key,Item) so always used named arguments

Public Property Get Item(Key As String) As VariantĪssignVariable Item, KeyValuePairs.Item(Key).value
Define sub in excel vba on mac update#
Public Property Set Item(Key As String, Item As Variant) ' Set dic.Item(Key) = value ' update an object value for an existing key Public Property Let Item(Key As String, Item As Variant) ' dic.Item(Key) = value ' update a scalar value for an existing key Public Property Get CompareMode() As VbCompareMethodĬompareMode = vbTextCompare '=1 vbBinar圜ompare=0 ' in Scripting.Dictionary this is writeable, here we have only vbtextCompare because we are using a Collection Public Tag As Variant ' read/write unrestricted Public KeyValuePairs As Collection ' open access but allows iteration 'plus KeyValuePairs collection, KeyValuePair(Index as long), Tag as variant 'Collection methods: Add, Count, Item, Remove Save this as a plain text file named Dictionary.cls and import into excel VERSION 1.0 CLASS 'Unrestricted class just to hold pairs of values together and permit Dictionary object updating Save this as a plain text file named KeyValuePair.cls and import into Excel VERSION 1.0 CLASS Patrick O'Beirne sysmod wrote a class set that addresses this issue.īe sure to stop by Patirk's Blog to say thanks! Also there is a chance he has a newer version. Pulling the Answer from the comments to prevent link rot. Write 2 completely separate routines to do the same thing ( please let this not be what needs to happen): isMac = CheckIfMac
Define sub in excel vba on mac mac#
' Change dictionary variable to some other data type that is Mac friendly and provides the same functionality


My question is, is there a way to make this work on a Mac? Which is the result of using the Tools > References > Microsoft Scripting Runtime library. I recently had a user attempt to use it on a Mac and received the following error: Compile Error: Can't find project or library
Define sub in excel vba on mac windows#
I have an Excel VBA project that makes heavy use of Windows Scripting Dictionary objects.
