Python COM server with VBA late biding + skip win register (no admin rights)
<p>I'm trying to <code>import</code> Python code into in VBA.</p>

<p>The code below works but <strong>requires admin rights</strong>. Is there a way to go around the win register need (assume I just don't have admin rights) but keep the 'late biding' behavior (dont want to Tools>>Reference every time I compile something new)</p>

<pre><code>class ProofOfConcept(object):
    def __init__(self):
        self.output = []

    def GetData(self):
        with open('C:\Users\MyPath\Documents\COMs\SourceData.txt') as FileObj:
            for line in FileObj:
                self.output.append(line)
            return self.output

class COMProofOfConcept(object):
    _reg_clsid_ = "{D25A5B2A-9544-4C07-8077-DB3611BE63E7}"
    _reg_progid_= 'RiskTools.ProofOfConcept'
    _public_methods_ = ['GetData']

def __init__(self):
    self.__ProofOfConcept = ProofOfConcept()

def GetData(self):
    return self.__ProofOfConcept.GetData()

if __name__=='__main__':
    print "Registering COM server..."
    import win32com.server.register
    win32com.server.register.UseCommandLine(COMProofOfConcept)
</code></pre>

<p>VBA Code that calls it:</p>

<pre><code>Sub TestProofOfConcept()
    Set PoF = CreateObject("RiskTools.ProofOfConcept")
    x = PoF.GetData()
    MsgBox x(0)
End Sub
</code></pre>

<p>In short, no.  The VBA runtime basically uses the <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms684007(v=vs.85).aspx" rel="nofollow">CoGetClassObject</a> COM API under the hood - the <code>CreateObject()</code> function is essentially just a thin wrapper around it (it calls <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms680589(v=vs.85).aspx" rel="nofollow">CLSIDFromString</a> to locate the CLSID from the parameter first).  Both of these functions require that the class be registered.</p>

python vba com winreg