<p>I have written a lot of code in Python, and I am very used to the syntax, object structure, and so forth of Python because of it.</p>

<p>What is the best online guide or resource site to provide me with the basics, as well as a comparison or lookup guide with equivalent functions/features in VBA versus Python.</p>

<p>For example, I am having trouble equating a simple List in Python to VBA code. I am also have issues with data structures, such as dictionaries, and so forth.  </p>

<p>What resources or tutorials are available that will provide me with a guide to porting python functionality to VBA, or just adapting to the VBA syntax from a strong OOP language background?</p>

[{'answer_id': 76950, 'author': 'Jiaaro', 'author_id': 2908, 'author_profile': 'https://Stackoverflow.com/users/2908', 'pm_score': 2, 'selected': False, 'text': '<p>This tutorial isn\'t \'for python programmers\' but I thinkit\'s a pretty good vba resource:</p>\n\n<p><a href="http://www.vbtutor.net/VBA/vba_tutorial.html" rel="nofollow noreferrer">http://www.vbtutor.net/VBA/vba_tutorial.html</a></p>\n\n<p>This site goes over a real-world example using lists:</p>\n\n<p><a href="http://www.ozgrid.com/VBA/count-of-list.htm" rel="nofollow noreferrer">http://www.ozgrid.com/VBA/count-of-list.htm</a></p>\n'}, {'answer_id': 76984, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>Probably not exactly what you are looking for but this is a decent VBA site if you have some programming background. It\'s not a list of this = that but more of a problem/solution</p>\n\n<p><a href="http://www.mvps.org/access/toc.htm" rel="nofollow noreferrer">http://www.mvps.org/access/toc.htm</a></p>\n'}, {'answer_id': 76989, 'author': 'Sam Corder', 'author_id': 2351, 'author_profile': 'https://Stackoverflow.com/users/2351', 'pm_score': 2, 'selected': False, 'text': "<p>VBA as in what was implemented as part of Office 2000, 2003 and VB6 have been deprecated in favor of .Net technologies.  Unless you are maintaining old code stick to python or maybe even go with IronPython for .Net.  If you go IronPython, you may have to write some C#/VB.Net helper classes here and there when working with various COM objects such as ones in Office but otherwise it is supposed to be pretty functional and nice.  Just about all of the Python goodness is over in IronPython.  If you are just doing some COM scripting take a look at what ActiveState puts out.  I've used it in the past to do some COM work.  Specifically using Python as an Active Scripting language (classic ASP).</p>\n"}, {'answer_id': 78708, 'author': 'S.Lott', 'author_id': 10661, 'author_profile': 'https://Stackoverflow.com/users/10661', 'pm_score': 0, 'selected': False, 'text': '<blockquote>\n  <p>"I\'m having trouble equating a simple\n  List in Python with something in\n  VBA..."</p>\n</blockquote>\n\n<p>This isn\'t the best way to learn the language.  In a way, you\'re giving up large pieces of Python because there isn\'t something like it in VBA.</p>\n\n<p>If there\'s nothing like a Python list in VBA, then -- well -- it\'s something new.  And new would be the significant value in parts of Python.</p>\n\n<p>The first parts of the Python <a href="http://docs.python.org/lib/types.html" rel="nofollow noreferrer">Built-in Types</a> may not map well to VBA.  That makes learning appear daunting.  But limiting yourself to just things that appear in VBA tends to prevent learning.</p>\n'}, {'answer_id': 185390, 'author': 'molasses', 'author_id': 11293, 'author_profile': 'https://Stackoverflow.com/users/11293', 'pm_score': 1, 'selected': False, 'text': '<p>I think the equivalent of lists would be arrays in terms of common usage.\nWhere it is common to use a list in Python you would normally use an array in VB.\nHowever, VB arrays are very inflexible compared to Python lists and are more like arrays in C.</p>\n\n<pre><code>\' An array with 3 elements\n\'\' The number inside the brackets represents the upper bound index\n\'\' ie. the last index you can access\n\'\' So a(2) means you can access a(0), a(1), and a(2) \'\n\nDim a(2) As String\na(0) = "a"\na(1) = "b"\na(2) = "c"\n\nDim i As Integer\nFor i = 0 To UBound(a)\n    MsgBox a(i)\nNext\n</code></pre>\n\n<p>Note that arrays in VB cannot be resized if you declare the initial number of elements.</p>\n\n<pre><code>\' Declare a "dynamic" array \'\n\nDim a() As Variant\n\n\' Set the array size to 3 elements \'\n\nReDim a(2)\na(0) = 1\na(1) = 2\n\n\' Set the array size to 2 elements\n\'\' If you dont use Preserve then you will lose\n\'\' the existing data in the array \'\n\nReDim Preserve a(1)\n</code></pre>\n\n<p>You will also come across various collections in VB.\neg. <a href="http://devguru.com/technologies/vbscript/14045.asp" rel="nofollow noreferrer">http://devguru.com/technologies/vbscript/14045.asp</a></p>\n\n<p>Dictionaries in VB can be created like this:</p>\n\n<pre><code>Set cars = CreateObject("Scripting.Dictionary")\ncars.Add "a", "Alvis"\ncars.Add "b", "Buick"\ncars.Add "c", "Cadillac" \n</code></pre>\n\n<p><a href="http://devguru.com/technologies/vbscript/13992.asp" rel="nofollow noreferrer">http://devguru.com/technologies/vbscript/13992.asp</a></p>\n'}, {'answer_id': 186583, 'author': 'tzot', 'author_id': 6899, 'author_profile': 'https://Stackoverflow.com/users/6899', 'pm_score': 5, 'selected': False, 'text': '<p>VBA is quite different from Python, so you should read at least the "Microsoft Visual Basic Help" as provided by the application you are going to use (Excel, Access…).</p>\n\n<p>Generally speaking, VBA has the equivalent of Python modules; they\'re called "Libraries", and they are not as easy to create as Python modules. I mention them because Libraries will provide you with higher-level types that you can use.</p>\n\n<p>As a start-up nudge, there are two types that can be substituted for <code>list</code> and <code>dict</code>.</p>\n\n<h2><code>list</code></h2>\n\n<p>VBA has the type <code>Collection</code>. It\'s available by default (it\'s in the library <code>VBA</code>). So you just do a<br>\n<code>dim alist as New Collection</code><br>\nand from then on, you can use its methods/properties:</p>\n\n<ul>\n<li><code>.Add(item)</code> ( list.append(item) ),</li>\n<li><code>.Count</code> ( len(list) ),</li>\n<li><code>.Item(i)</code> ( list[i] ) and</li>\n<li><code>.Remove(i)</code> ( del list[i] ). Very primitive, but it\'s there.</li>\n</ul>\n\n<p>You can also use the VBA Array type, which like python arrays are lists of same-type items, and unlike python arrays, you need to do <code>ReDim</code> to change their size (i.e. you can\'t just append and remove items)</p>\n\n<h2><code>dict</code></h2>\n\n<p>To have a dictionary-like object, you should add the Scripting library to your VBA project¹. Afterwards, you can<br>\n<code>Dim adict As New Dictionary</code><br>\nand then use its properties/methods:</p>\n\n<ul>\n<li><code>.Add(key, item)</code> ( dict[key] = item ),</li>\n<li><code>.Exists(key)</code> ( dict.has_key[key] ),</li>\n<li><code>.Items()</code> ( dict.values() ),</li>\n<li><code>.Keys()</code> ( dict.keys() ),<br>\nand others which you will find in the Object Browser².</li>\n</ul>\n\n<p>¹ Open VBA editor (Alt+F11). Go to Tools→References, and check the "Microsoft Scripting Runtime" in the list.</p>\n\n<p>² To see the Object Browser, in VBA editor press F2 (or View→Object Browser).</p>\n'}, {'answer_id': 186641, 'author': 'CtrlDot', 'author_id': 19487, 'author_profile': 'https://Stackoverflow.com/users/19487', 'pm_score': 0, 'selected': False, 'text': '<p>This may sound weird, but since I learned data structures in C++, I had a really hard time figuring out how to create them without pointers. There\'s something about VB6/VBA that makes them feel unnatural to me. Anyway, I came across this section of MSDN that has several data structure examples written in VBA. I found it useful.</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/aa227473(VS.60).aspx" rel="nofollow noreferrer">Creating Dynamic Data Structures Using Class Modules</a></p>\n'}, {'answer_id': 189311, 'author': 'JonnyGold', 'author_id': 2665, 'author_profile': 'https://Stackoverflow.com/users/2665', 'pm_score': 2, 'selected': False, 'text': "<p>While I'm not a Python programmer, you might be able to run VSTO with Iron Python and Visual Studio. At least that way, you won't have to learn VBA syntax.</p>\n"}]
['https://Stackoverflow.com/questions/76882', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']