<p>In a macro for Visual Studio 6, I wanted to run an external program, so I typed:</p>

<pre><code>shell("p4 open " + ActiveDocument.FullName)
</code></pre>

<p>Which gave me a type mismatch runtime error. What I ended up having to type was this:</p>

<pre><code>Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
strResult = wshShell.Run("p4 open " + ActiveDocument.FullName)
</code></pre>

<p>What is going on here? Is that nonsense really necessary or have I missed something?</p>

[{'answer_id': 20304, 'author': 'Lasse V. Karlsen', 'author_id': 267, 'author_profile': 'https://Stackoverflow.com/users/267', 'pm_score': 1, 'selected': False, 'text': "<p>VBScript isn't Visual Basic.</p>\n"}, {'answer_id': 20353, 'author': 'Bryan Roth', 'author_id': 299, 'author_profile': 'https://Stackoverflow.com/users/299', 'pm_score': 0, 'selected': False, 'text': '<p>Give this a try:</p>\n\n<pre><code>Shell "p4 open" &amp; ActiveDocument.FullName\n</code></pre>\n'}, {'answer_id': 29042, 'author': 'Michael Pryor', 'author_id': 245, 'author_profile': 'https://Stackoverflow.com/users/245', 'pm_score': 2, 'selected': True, 'text': '<p>As <a href="https://stackoverflow.com/questions/20272/why-doesnt-shell-work-in-vbscript-in-vs6#20304">lassevk</a> pointed out, VBScript is not Visual Basic.</p>\n\n<p>I believe the only built in object in VBScript is the WScript object.</p>\n\n<pre><code>WScript.Echo "Hello, World!"\n</code></pre>\n\n<p>From the docs</p>\n\n<blockquote>\n  <p>The WScript object is the root object of the Windows Script Host\n  object model hierarchy. It never needs to be instantiated before invoking its\n  properties and methods, and it is always available from any script file.</p>\n</blockquote>\n\n<p>Everything else must be created via the CreateObject call.  Some of those objects are <a href="http://msdn.microsoft.com/en-us/library/f51wc7hz(VS.85).aspx" rel="nofollow noreferrer">listed here</a>.</p>\n\n<p>The Shell object is one of the <em>other</em> objects that you need to create if you want to call methods on it.</p>\n\n<p>One caveat, is that RegExp is <em>sort of</em> built in, in that you can instantiate a RegExp object like so in VBScript:</p>\n\n<pre><code>Dim r as New RegExp\n</code></pre>\n'}, {'answer_id': 29096, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': -1, 'selected': False, 'text': '<p>VB6 uses &amp; to concatenate strings rather than +, and you\'ll want to make sure the file name is encased in quotes in case of spaces.  Try it like this: </p>\n\n<pre><code>Shell "p4 open """ &amp; ActiveDocument.FullName &amp; """"\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/20272', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1105/']